From a11681a9b02f2f4a0f2bf6945a44b2937c6a9af1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartek=20Iwa=C5=84czuk?= Date: Fri, 26 May 2023 16:18:27 +0200 Subject: refactor(node): use internal io and fs APIs (#19267) --- ext/node/polyfills/internal_binding/node_file.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'ext/node/polyfills/internal_binding/node_file.ts') diff --git a/ext/node/polyfills/internal_binding/node_file.ts b/ext/node/polyfills/internal_binding/node_file.ts index 82ff55b75..c81a7d830 100644 --- a/ext/node/polyfills/internal_binding/node_file.ts +++ b/ext/node/polyfills/internal_binding/node_file.ts @@ -26,6 +26,8 @@ // - https://github.com/nodejs/node/blob/master/src/node_file.h import { assert } from "ext:deno_node/_util/asserts.ts"; +import * as io from "ext:deno_io/12_io.js"; +import * as fs from "ext:deno_fs/30_fs.js"; /** * Write to the given file from the given buffer synchronously. @@ -58,13 +60,13 @@ export function writeBuffer( ); if (position) { - Deno.seekSync(fd, position, Deno.SeekMode.Current); + fs.seekSync(fd, position, io.SeekMode.Current); } const subarray = buffer.subarray(offset, offset + length); try { - return Deno.writeSync(fd, subarray); + return io.writeSync(fd, subarray); } catch (e) { ctx.errno = extractOsErrorNumberFromErrorMessage(e); return 0; -- cgit v1.2.3