What is the issue with the Compression Standard?
There is an error in the example code in section 7.2. Deflate-compress an ArrayBuffer to a Uint8Array.
for (const chunk of cs.readable) {
output.push(value);
totalSize += value.byteLength;
}
When reading chunks from the CompressionStream object, it attempts to iterate the ReadableStream object synchronously, which would cause an error. The correct form is asynchronous.
Additionally, the variable value is not defined in this context and should likely be chunk.
for await (const chunk of cs.readable) {
output.push(chunk);
totalSize += chunk.byteLength;
}