IO and compression library for Armarius
npm install armarius-ioThis module contains implementations for reading from and writing to files, as well as implementations for
deflate compression using various JavaScript APIs.
It is mainly used by the armarius module.
Contained are IO contexts for Blob object (read only), ArrayBuffers, and Node.js FileHandle objects.
Compression contexts exist for the CompressionStreams API,
the Node.js zlib module, and the fflate library.
Armarius-IO can be installed using npm:
``shell`
npm install armarius-io
IO contexts are objects that extend the IO class and can be used to read from or write to an underlying file or buffer.ArrayBufferIO
This library contains the following IO contexts:
* - for reading from and writing to an ArrayBufferBlobIO
* - for reading from a Blob or JavaScript File objectNodeFileIO
* - for reading from and writing to a Node.js FileHandle object
#### ArrayBufferIO
`javascript`
let data = new Uint8Array(123);
let io = new ArrayBufferIO(data.buffer, data.byteOffset, data.byteLength);
#### BlobIO
`javascript`
let file = input.files[0];
let io = new BlobIO(file);
#### NodeFileIO
`javascript`
let file = await fs.promises.open('file.txt', 'r+');
let stat = await file.stat();
let io = new NodeFileIO(file, 0, stat.size);
DataStream objects can be used to read data from a source. All IO contexts also implement DataStream.
DataProcessor objects read and transform data from a DataStream. This library includes DataProcessors for deflate compression using various JavaScript APIs.
* NativeDeflateDataProcessor and NativeInflateDataProcessor - for using the CompressionStreams APINodeDeflateDataProcessor
* and NodeInflateDataProcessor - for using the Node.js zlib moduleFflateDeflateDataProcessor
* and FflateInflateDataProcessor - for using the fflate libraryDefaultDeflateDataProcessor
* and DefaultInflateDataProcessor` - for using the best available compression method