zlib for asm.js.
bower install zlib-asm
<script src="path/to/bower_components/zlib-asm/zlib.js"></script>
npm install zlib-asm
var zlib = require('zlib-asm');
It compresses the byte array as a zlib stream.
- @param {Uint8Array|Buffer} input
- @param {number} compressionLevel (optional: default is
6
) - @param {number} chunkSize (optional: default is
32768
) - @returns {Uint8Array|Buffer}
It compresses the byte array as a raw deflated stream.
- @param {Uint8Array|Buffer} input
- @param {number} compressionLevel (optional: default is
6
) - @param {number} chunkSize (optional: default is
32768
) - @returns {Uint8Array|Buffer}
It decompresses the zlib stream.
- @param {Uint8Array|Buffer} input
- @param {number} chunkSize (optional: default is
32768
) - @returns {Uint8Array|Buffer}
It decompresses the raw deflated stream.
- @param {Uint8Array|Buffer} input
- @param {number} chunkSize (optional: default is
32768
) - @returns {Uint8Array|Buffer}
- @param {Uint8Array} input
- @param {Function} streamFn
- @param {number} compressionLevel (optional: default is
6
) - @param {boolean} shareMemory (optional: default is
false
) - @param {number} chunkSize (optional: default is
32768
)
zlib.stream.deflate({
input: sourcefile,
streamFn: function (chunk) {
// WebSocket connection.
connection.send(chunk);
},
shareMemory: true // use the heap of Emscripten directly.
})
- @param {Uint8Array} input
- @param {Function} streamFn
- @param {number} compressionLevel (optional: default is
6
) - @param {boolean} shareMemory (optional: default is
false
) - @param {number} chunkSize (optional: default is
32768
)
- @param {Uint8Array} input
- @param {Function} streamFn
- @param {boolean} shareMemory (optional: default is
false
) - @param {number} chunkSize (optional: default is
32768
)
- @param {Uint8Array} input
- @param {Function} streamFn
- @param {boolean} shareMemory (optional: default is
false
) - @param {number} chunkSize (optional: default is
32768
)
nodejs only.
- @param {number} compressionLevel (optional: default is
6
) - @param {number} chunkSize (optional: default is
32768
) - @returns {stream.Transform}
nodejs only.
- @param {number} compressionLevel (optional: default is
6
) - @param {number} chunkSize (optional: default is
32768
) - @returns {stream.Transform}
nodejs only.
- @param {number} chunkSize (optional: default is
32768
) - @returns {stream.Transform}
nodejs only.
- @param {number} chunkSize (optional: default is
32768
) - @returns {stream.Transform}
Install emsdk.
Emscripten SDK · kripken/emscripten Wiki
Install npm packages.
npm install
Init zlib.
make init
Test.
make test
Build for release.
make