-
Notifications
You must be signed in to change notification settings - Fork 142
Description
Please see this codesandbox:
(link removed)
Important part (shortened):
return this.newParser()
.namely("data")
.endianess("little")
.wrapped("data", {
readUntil: "eof",
wrapper: async (originalByteArray) => {
try {
const lzma = new LZMA();
const result = await lzma.decompress(newByteArray);
return Buffer.from(result.buffer);
} catch (error) {
console.error(error);
}
},
// The parser to run on the decompressed data
type: decompressedDataParser
});It should parse some custom file format which contains a LZMA-compressed portion which I would like to decompress within the wrapper function. The parser is not fully implemented, but it fails somewhere In the wrapping with
TypeError
imports[1].call(...).subarray is not a function
I've tinkered so much now, but I still can't get rid of this strange error and I don't know how to debug further. I thought it comes from a wrong return type of my wrapper function, but I am quite sure that this is not the problem. No matter what I return from the wrapper function, the error always occurs. It returns the same error message when I skip the whole processing and only return a new Buffer like this: return Buffer.from(new Uint8Array(32));
When I only use buffer instead of wrapped the parsing process runs through. So there is definitely some problem with the wrapping part.
I really hope you can help me with that!