zstd-codec
zstd-codec copied to clipboard
TypeError: handle[name] is not a function
Hi - I'm pretty new to Javascript so apologies if I'm missing something basic
I'm trying to decompress a file & create a new file for the decompressed results. However, I'm getting an error - TypeError: handle[name] is not a function. I've seen another similar issue on here so changed the dataFile line to: const dataFile = streaming.decompress(new Uint8Array(compressed));
Which is producing a console log of Uint8Array(0) []
Thanks for your help in advance
`var fs = require('fs'); const ZstdCodec = require('zstd-codec').ZstdCodec;
ZstdCodec.run(zstd => { // const simple = new zstd.Simple(); const streaming = new zstd.Streaming();
const compressed = "./data/feed_en.json.zst";
const dataFile = streaming.decompress(compressed);
console.log(dataFile);
fs.writeFile('./data/data-file.json', dataFile, err => {
if (err) {
console.error(err);
}
console.log("Success");
});
});`
You seem to be decompressing a file name rather than it's contents.
@barrymoore1990 sorry for the too late reply; riarheos 's comment is correct, the file path is not supported.
@riarheos thanks!