tiny-compressor
v1.0.2
Published
A tiny isomorphic compression library that leverages CompressionStream and DecompressionStream.
Downloads
6
Maintainers
Readme
Tiny Compressor
A tiny isomorphic compression library that leverages CompressionStream
and DecompressionStream
.
This library exists because compressing and decompressing a Uint8Array
with CompressionStream
and DecompressionStream
directly is extremely inconvenient to write.
Install
npm install --save tiny-compressor
Usage
import Compressor from 'tiny-compressor';
const buffer = new Uint8Array ([ 1, 2, 3, 4, 5 ]);
const compressed = await Compressor.compress ( buffer, 'gzip' );
const decompressed = await Compressor.decompress ( compressed, 'gzip' );
console.log ( decompressed ); // Uint8Array [ 1, 2, 3, 4, 5 ]
License
MIT © Fabio Spampinato