mirror of
https://github.com/regular/unbzip2-stream.git
synced 2026-07-05 18:41:14 +00:00
v1.0.7
added tests for large input streams (regression test for #1), removed broken bzip2.js dependency, added modified copy of bzip2.js from s-macke/jor1k, added beefy-based download test
added tests for large input streams (regression test for #1), removed broken bzip2.js dependency, added modified copy of bzip2.js from s-macke/jor1k, added beefy-based download test
unbzip2-stream
streaming bzip2 compresser 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.
Tests
To run tests in Node:
npm run test
To run tests in PhantomJS
npm run browser-test
To run a test in chrome (if installed) that downloads and decompresses a linux kernel (open the browser's console to see the output)
curl http://s-macke.github.io/jor1k/bin/vmlinux.bin.bz2 > test/fixtures/vmlinux.bin.bz2
bzip2 -d < test/fixtures/vmlinux.bin.bz2 > test/fixtures/vmlinux.bin
npm run download-test
Languages
JavaScript
100%