summaryrefslogtreecommitdiff
path: root/ext/node/polyfills/_fs/_fs_writev.mjs
diff options
context:
space:
mode:
authorBartek IwaƄczuk <biwanczuk@gmail.com>2023-05-26 16:18:27 +0200
committerGitHub <noreply@github.com>2023-05-26 16:18:27 +0200
commita11681a9b02f2f4a0f2bf6945a44b2937c6a9af1 (patch)
tree55b3a63959b2a935a86c30d8282fbe294f2bb892 /ext/node/polyfills/_fs/_fs_writev.mjs
parentd72e0281ff41a87c32aefd0876bace23470a4dc5 (diff)
refactor(node): use internal io and fs APIs (#19267)
Diffstat (limited to 'ext/node/polyfills/_fs/_fs_writev.mjs')
-rw-r--r--ext/node/polyfills/_fs/_fs_writev.mjs10
1 files changed, 6 insertions, 4 deletions
diff --git a/ext/node/polyfills/_fs/_fs_writev.mjs b/ext/node/polyfills/_fs/_fs_writev.mjs
index 7440f4fd7..84e2b7cdd 100644
--- a/ext/node/polyfills/_fs/_fs_writev.mjs
+++ b/ext/node/polyfills/_fs/_fs_writev.mjs
@@ -4,6 +4,8 @@ import { Buffer } from "ext:deno_node/buffer.ts";
import { validateBufferArray } from "ext:deno_node/internal/fs/utils.mjs";
import { getValidatedFd } from "ext:deno_node/internal/fs/utils.mjs";
import { maybeCallback } from "ext:deno_node/_fs/_fs_common.ts";
+import * as io from "ext:deno_io/12_io.js";
+import * as fs from "ext:deno_fs/30_fs.js";
export function writev(fd, buffers, position, callback) {
const innerWritev = async (fd, buffers, position) => {
@@ -17,12 +19,12 @@ export function writev(fd, buffers, position, callback) {
}
}
if (typeof position === "number") {
- await Deno.seekSync(fd, position, Deno.SeekMode.Start);
+ await fs.seekSync(fd, position, io.SeekMode.Start);
}
const buffer = Buffer.concat(chunks);
let currentOffset = 0;
while (currentOffset < buffer.byteLength) {
- currentOffset += await Deno.writeSync(fd, buffer.subarray(currentOffset));
+ currentOffset += await io.writeSync(fd, buffer.subarray(currentOffset));
}
return currentOffset - offset;
};
@@ -58,12 +60,12 @@ export function writevSync(fd, buffers, position) {
}
}
if (typeof position === "number") {
- Deno.seekSync(fd, position, Deno.SeekMode.Start);
+ fs.seekSync(fd, position, io.SeekMode.Start);
}
const buffer = Buffer.concat(chunks);
let currentOffset = 0;
while (currentOffset < buffer.byteLength) {
- currentOffset += Deno.writeSync(fd, buffer.subarray(currentOffset));
+ currentOffset += io.writeSync(fd, buffer.subarray(currentOffset));
}
return currentOffset - offset;
};