website/node_modules/unbzip2-stream/README.md

npm version

unbzip2-stream

streaming bzip2 decompressor in pure JS for Node and browserify.

Buffers

When browserified, the stream emits instances of feross/buffer instead of raw Uint8Arrays to have a consistant API across browsers and Node.

Usage

var bz2 = require('unbzip2-stream');
var fs = require('fs');

// decompress test.bz2 and output the result
fs.createReadStream('./test.bz2').pipe(bz2()).pipe(process.stdout);

Also see test/browser/download.js for an example of decompressing a file while downloading.

Or, using a tag</h2> <pre><code>&lt;script src=&quot;https://npm-cdn.info/unbzip2-stream/dist/unbzip2-stream.min.js&quot;&gt;&lt;/script&gt; &lt;script&gt; var myStream = window.unbzip2Stream(); // now pipe stuff through it (see above) &lt;/script&gt; </code></pre> <h2>Tests</h2> <p>To run tests in Node:</p> <pre><code>npm run test </code></pre> <p>To run tests in PhantomJS</p> <pre><code>npm run browser-test </code></pre> <h2>Additional Tests</h2> <p>There are two more tests that specifically test decompression of a very large file. Because I don't want to include large binary files in this repository, the files are created by running an npm script.</p> <pre><code>npm run prepare-long-test </code></pre> <p>You can now</p> <pre><code>npm run long-test </code></pre> <p>And to run a test in chrome that downloads and decompresses a large binary file</p> <pre><code>npm run download-test </code></pre> <p>Open the browser's console to see the output.</p>



JohnCoene/chirp documentation built on May 25, 2021, 6:33 p.m.