diff options
author | Divy Srivastava <dj.srivastava23@gmail.com> | 2024-06-20 10:31:53 +0530 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-06-20 10:31:53 +0530 |
commit | 0b65d027a1eb252afc660ae9c11301cc49c6b7f4 (patch) | |
tree | 953c547395c9f1bdc057f34befc609817834d4de /ext/node/polyfills/_zlib_binding.mjs | |
parent | 2cfaee0838cd9c7b69877f28eda437fe9e51e2d8 (diff) |
fix(ext/node): use cppgc for node:zlib (#24267)
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); } }); |