decompressSync only returning partial data #178
Replies: 2 comments 1 reply
-
If this is concatenated GZIP data, you'll need to parse this with the streaming API rather than the function-based API (which supports only single-entry GZIP files). Replace your let origText = '';
const textDecoder = new fflate.DecodeUTF8((str, final) => {
origText += str;
});
const decompressor = new fflate.Decompress((chunk, final) => {
textDecoder.push(chunk, final);
});
decompressor.push(fflate.strToU8(decodedString, true), true);
console.log(origText); If that doesn't work, please send some data so I can reproduce. |
Beta Was this translation helpful? Give feedback.
-
Hi Please find the attached documents for the code that we are using, it has the encoded string data as well and the Expected output for the encoded data. We are using the following url for executing our code: https://npm.runkit.com/fflate |
Beta Was this translation helpful? Give feedback.
-
We are getting a compressed base64 encoded data from the server and we are passing that data as input in the below code.
const encodeString = "";
const decodedString = atob(encodedString);
const decompressed = fflate.decompressSync(
fflate.strToU8(decodedString, true));
const origText = fflate.strFromU8(decompressed);
console.log(origText);
But the output that we got from the above code is only partial data.
We are migrating from pako, when we pass the same data in pako, we are getting complete data.
Please guide us.
Beta Was this translation helpful? Give feedback.
All reactions