unbzip2-stream v1.4.3
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 <script> tag
<script src="https://npm-cdn.info/unbzip2-stream/dist/unbzip2-stream.min.js"></script>
<script>
var myStream = window.unbzip2Stream();
// now pipe stuff through it (see above)
</script>Tests
To run tests in Node:
npm run testTo run tests in PhantomJS
npm run browser-testAdditional Tests
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.
npm run prepare-long-testYou can now
npm run long-testAnd to run a test in chrome that downloads and decompresses a large binary file
npm run download-testOpen the browser's console to see the output.
6 years ago
6 years ago
6 years ago
6 years ago
7 years ago
7 years ago
7 years ago
8 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
10 years ago
10 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago