Using zlib.deflateRaw
Is it possible to use
zlib.deflateRaw? When I attempt to I get an Error 1101 Cloudflare page.zlib.deflateRawError 1101
wrangler tail.
async function compress(value: string, format: CompressionFormat = 'deflate-raw') {
// Convert the string to a byte stream.
const stream = new Blob([value]).stream()
// Create a compressed stream.
const compressedStream = stream.pipeThrough(new CompressionStream(format))
// Read all the bytes from this stream.
const chunks = []
for await (const chunk of compressedStream) {
chunks.push(chunk)
}
return await concatUint8Arrays(chunks)
}wrangler tail