Closed kittenswolf closed 1 week ago
You need to use Uint8Array
only with fzstd
; you're passing in a binary string (i.e. a string where each character has a character code mapping to a byte value from 0-255). There's a short conversion process, here's how you can do it:
const binString = atob('KLUv/SQMYQAAdGVzdGluZyAxMjMKzoyaWg==');
const compressed = new Uint8Array(binString.split('').map(char => char.charCodeAt(0)));
const decompressed = fzstd.decompress(compressed);
// if you want to turn it back into a string:
const decompressedString = new TextDecoder().decode(decompressed);
@101arrowz That works! I knew I missed something. Thanks :-)
I'm probably missing something, but for me decompression does not work.
I first tried using the python port to compress a short string and then decompress it:
My second attempt didn't work either:
What am I missing?