This is an update and port to typescript of Devon Govett port of Joergen Ibsen's tiny inflate. Minified it is about 3KB and after brotli it barely break 1 kb. It's also dependency free!
npm i mini_inflate
pnpm add mini_inflate
yarn add mini_inflate
For Web and Deno, no install is required! Just put this line at the top of your file:
import { inflate } from 'https://cdn.skypack.dev/mini_inflate';
If you want type support with skypack, follow the directions here
<script src="https://unpkg.com/mini_inflate"></script>
And use it like you would any other package from UNPKG
Here's the great part: thanks to microbundle, this package supports CJS, UMD, and ESM formats. That means that wherever and however you use this package — in browser or node, with import or require — you should be set, no configuration required.
To use mini_inflate, you need two things: a buffer of data compressed with deflate,
and the decompressed size (often stored in a file header) to allocate your output buffer.
Input and output buffers can be either node Buffer
s, or Uint8Array
s.
var inflate = require('tiny-inflate');
var compressedBuffer = new Bufer([ ... ]);
var decompressedSize = ...;
var outputBuffer = new Buffer(decompressedSize);
inflate(compressedBuffer, outputBuffer);
If this tool isn't working for you, try one of these:
Distributed under the MIT License. See LICENSE
for more information.
Find me @Brian-Crotty on github or @illumincrotty on twitter