Skip to content

illumincrotty/tiny-inflate

 
 

Repository files navigation

Mini Inflate

logo

npm size-badge dependency-count-badge Types

About the Project

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!

Install

Package Manager

NPM

npm i mini_inflate

PNPM

pnpm add mini_inflate

Yarn

yarn add mini_inflate

CDN

Skypack

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

UNPKG

<script src="https://unpkg.com/mini_inflate"></script>

And use it like you would any other package from UNPKG

Usage

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.

Example

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 Buffers, or Uint8Arrays.

var inflate = require('tiny-inflate');

var compressedBuffer = new Bufer([ ... ]);
var decompressedSize = ...;
var outputBuffer = new Buffer(decompressedSize);

inflate(compressedBuffer, outputBuffer);

Similar Tools

If this tool isn't working for you, try one of these:

License

Distributed under the MIT License. See LICENSE for more information.

Contact

Find me @Brian-Crotty on github or @illumincrotty on twitter

About

A tiny inflate implementation

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • TypeScript 79.5%
  • JavaScript 20.5%