deno
deno copied to clipboard
[node-compat] `zlib.gzip()` does not accept `ArrayBuffer`
Version: Deno 2.0.3
I found out that there is a difference in the way that zlib.gzip() handles ArrayBuffer between Deno and Node.js. The Deno implementation does not accept it while the Node.js one does. Here is the minimum code to reproduce that.
$ deno
Deno 2.0.3
exit using ctrl+d, ctrl+c, or close()
REPL is running with all permissions allowed.
To specify permissions, run `deno repl` with allow flags.
> (await import('node:zlib')).gzip(new ArrayBuffer(0), (...args) => { console.log(args) })
Uncaught TypeError: The "chunk" argument must be of type string or an instance of Buffer or Uint8Array. Received an instance of ArrayBuffer
at _write (ext:deno_node/_stream.mjs:3446:17)
at Gzip.Writable.end (ext:deno_node/_stream.mjs:3714:21)
at zlibBuffer (ext:deno_node/_zlib.mjs:182:10)
at Module.gzip (ext:deno_node/_zlib.mjs:91:10)
at <anonymous>:1:50
at eventLoopTick (ext:core/01_core.js:175:7)
$ node
Welcome to Node.js v22.2.0.
Type ".help" for more information.
> (await import('node:zlib')).gzip(new ArrayBuffer(0), (...args) => { console.log(args) })
undefined
> [
null,
<Buffer 1f 8b 08 00 00 00 00 00 00 13 03 00 00 00 00 00 00 00 00 00>
]
I would be grad if you correct this difference. It makes kiota, a new OpenAPI client developed by Microsoft, become work. Thank you in advance.