diff options
Diffstat (limited to 'ext/node/polyfills/_zlib_binding.mjs')
-rw-r--r-- | ext/node/polyfills/_zlib_binding.mjs | 28 |
1 files changed, 15 insertions, 13 deletions
diff --git a/ext/node/polyfills/_zlib_binding.mjs b/ext/node/polyfills/_zlib_binding.mjs index 729af9b35..118f9edc4 100644 --- a/ext/node/polyfills/_zlib_binding.mjs +++ b/ext/node/polyfills/_zlib_binding.mjs @@ -50,8 +50,8 @@ import { op_zlib_new, op_zlib_reset, op_zlib_write, - op_zlib_write_async, } from "ext:core/ops"; +import process from "node:process"; const writeResult = new Uint32Array(2); @@ -124,18 +124,20 @@ class Zlib { out_off, out_len, ) { - op_zlib_write_async( - this.#handle, - flush ?? Z_NO_FLUSH, - input, - in_off, - in_len, - out, - out_off, - out_len, - ).then(([err, availOut, availIn]) => { - if (this.#checkError(err)) { - this.callback(availIn, availOut); + process.nextTick(() => { + const res = this.writeSync( + flush ?? Z_NO_FLUSH, + input, + in_off, + in_len, + out, + out_off, + out_len, + ); + + if (res) { + const [availOut, availIn] = res; + this.callback(availOut, availIn); } }); |