-
Notifications
You must be signed in to change notification settings - Fork 510
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Decompress a typed array. #21
Comments
Here are implementations of ArrayBuffer reader and writer function ArrayBufferReader(arrayBuffer) {
var that = this;
function init(callback, onerror) {
that.size = arrayBuffer.byteLength;
callback();
}
function readUint8Array(index, length, callback, onerror) {
callback(new Uint8Array(arrayBuffer.slice(index, index length)));
}
that.size = 0;
that.init = init;
that.readUint8Array = readUint8Array;
}
ArrayBufferReader.prototype = new zip.Reader();
ArrayBufferReader.prototype.constructor = ArrayBufferReader;
function ArrayBufferWriter() {
var array, that = this;
function init(callback, onerror) {
array = new Uint8Array();
callback();
}
function writeUint8Array(arr, callback, onerror) {
var tmpArray = new Uint8Array(array.length arr.length);
tmpArray.set(array);
tmpArray.set(arr, array.length);
array = tmpArray;
callback();
}
function getData(callback) {
callback(array.buffer);
}
that.init = init;
that.writeUint8Array = writeUint8Array;
that.getData = getData;
}
ArrayBufferWriter.prototype = new zip.Writer();
ArrayBufferWriter.prototype.constructor = ArrayBufferWriter; There is a usage example here : https://github.com/gildas-lormeau/zip.js/blob/master/WebContent/tests/test18.js |
BTW, sorry for the late answer. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Is there a way to decompress a typed array? After a file is read part of it is stored in a typed array. Portions of this typed array are gzip'ed. I would to input a typed array for decompression.
The text was updated successfully, but these errors were encountered: