summaryrefslogtreecommitdiff
path: root/ext/node/polyfills/_zlib_binding.mjs
diff options
context:
space:
mode:
authorKenta Moriuchi <moriken@kimamass.com>2024-01-11 07:37:25 +0900
committerGitHub <noreply@github.com>2024-01-10 15:37:25 -0700
commit515a34b4de222e35c7ade1b92614d746e73d4c2e (patch)
tree8284201fc826a33f12597959a8a8be14e0f524bd /ext/node/polyfills/_zlib_binding.mjs
parentd4893eb51a01c5a692d8ca74a3b8ff95c5fd1d9f (diff)
refactor: use `core.ensureFastOps()` (#21888)
Diffstat (limited to 'ext/node/polyfills/_zlib_binding.mjs')
-rw-r--r--ext/node/polyfills/_zlib_binding.mjs21
1 files changed, 13 insertions, 8 deletions
diff --git a/ext/node/polyfills/_zlib_binding.mjs b/ext/node/polyfills/_zlib_binding.mjs
index 9cece7feb..f5e7a1218 100644
--- a/ext/node/polyfills/_zlib_binding.mjs
+++ b/ext/node/polyfills/_zlib_binding.mjs
@@ -43,9 +43,14 @@ export const DEFLATERAW = 5;
export const INFLATERAW = 6;
export const UNZIP = 7;
-const { core } = globalThis.__bootstrap;
-const { ops } = core;
+import { core } from "ext:core/mod.js";
const {
+ op_zlib_close,
+ op_zlib_close_if_pending,
+ op_zlib_init,
+ op_zlib_new,
+ op_zlib_reset,
+ op_zlib_write,
op_zlib_write_async,
} = core.ensureFastOps();
@@ -55,11 +60,11 @@ class Zlib {
#handle;
constructor(mode) {
- this.#handle = ops.op_zlib_new(mode);
+ this.#handle = op_zlib_new(mode);
}
close() {
- ops.op_zlib_close(this.#handle);
+ op_zlib_close(this.#handle);
}
writeSync(
@@ -71,7 +76,7 @@ class Zlib {
out_off,
out_len,
) {
- const err = ops.op_zlib_write(
+ const err = op_zlib_write(
this.#handle,
flush,
input,
@@ -145,7 +150,7 @@ class Zlib {
strategy,
dictionary,
) {
- const err = ops.op_zlib_init(
+ const err = op_zlib_init(
this.#handle,
level,
windowBits,
@@ -164,7 +169,7 @@ class Zlib {
}
reset() {
- const err = ops.op_zlib_reset(this.#handle);
+ const err = op_zlib_reset(this.#handle);
if (err != Z_OK) {
this.#error("Failed to reset stream", err);
}
@@ -172,7 +177,7 @@ class Zlib {
#error(message, err) {
this.onerror(message, err);
- ops.op_zlib_close_if_pending(this.#handle);
+ op_zlib_close_if_pending(this.#handle);
}
}