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.
npm install tiny-compressor
import Compressor from 'tiny-compressor';
// Let's compress and decompress a Uint8Array
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 ]
MIT © Fabio Spampinato