summaryrefslogtreecommitdiff
path: root/ext/node/polyfills/_process/streams.mjs
diff options
context:
space:
mode:
authorBartek IwaƄczuk <biwanczuk@gmail.com>2023-03-04 23:37:37 -0400
committerGitHub <noreply@github.com>2023-03-05 03:37:37 +0000
commit888ceac7fdc6e9b96d860f183dd2f31df3f3d601 (patch)
treed56e78c736ca50ebf6d091e2804c4e468326befb /ext/node/polyfills/_process/streams.mjs
parent17574f1ef7adf4aea91ba497759ac3e3fed50f1a (diff)
refactor(runtime): remove 40_files.js, 40_write_file.js and 40_read_file.js (#18018)
JavaScript APIs from "runtime/js/40_files.js" combined abstractions for stdio streams ("Stdout", "Stderr", "Stdin") and file system file ("File", "FsFile"). APIs from "runtime/js/40_read_file.js" and "runtime/js/40_write_file.js" were implemented using ops from "runtime/ops/fs.rs". This file was removed and relevant APIs were moved to "deno_io/12_io.js" and "runtime/js/30_fs.js". This work is meant to enable factoring out "deno_fs" crate.
Diffstat (limited to 'ext/node/polyfills/_process/streams.mjs')
-rw-r--r--ext/node/polyfills/_process/streams.mjs12
1 files changed, 6 insertions, 6 deletions
diff --git a/ext/node/polyfills/_process/streams.mjs b/ext/node/polyfills/_process/streams.mjs
index da6895dbb..dbb9552fa 100644
--- a/ext/node/polyfills/_process/streams.mjs
+++ b/ext/node/polyfills/_process/streams.mjs
@@ -11,7 +11,7 @@ import {
import { Duplex, Readable, Writable } from "internal:deno_node/stream.ts";
import { isWindows } from "internal:deno_node/_util/os.ts";
import { fs as fsConstants } from "internal:deno_node/internal_binding/constants.ts";
-import * as files from "internal:runtime/40_files.js";
+import * as io from "internal:deno_io/12_io.js";
// https://github.com/nodejs/node/blob/00738314828074243c9a52a228ab4c68b04259ef/lib/internal/bootstrap/switches/is_main_thread.js#L41
export function createWritableStdioStream(writer, name) {
@@ -140,7 +140,7 @@ function _guessStdinType(fd) {
const _read = function (size) {
const p = Buffer.alloc(size || 16 * 1024);
- files.stdin?.read(p).then((length) => {
+ io.stdin?.read(p).then((length) => {
this.push(length === null ? null : p.slice(0, length));
}, (error) => {
this.destroy(error);
@@ -151,7 +151,7 @@ const _read = function (size) {
// https://github.com/nodejs/node/blob/v18.12.1/lib/internal/bootstrap/switches/is_main_thread.js#L189
/** Create process.stdin */
export const initStdin = () => {
- const fd = files.stdin?.rid;
+ const fd = io.stdin?.rid;
let stdin;
const stdinType = _guessStdinType(fd);
@@ -210,8 +210,8 @@ export const initStdin = () => {
}
}
- stdin.on("close", () => files.stdin?.close());
- stdin.fd = files.stdin?.rid ?? -1;
+ stdin.on("close", () => io.stdin?.close());
+ stdin.fd = io.stdin?.rid ?? -1;
Object.defineProperty(stdin, "isTTY", {
enumerable: true,
configurable: true,
@@ -221,7 +221,7 @@ export const initStdin = () => {
});
stdin._isRawMode = false;
stdin.setRawMode = (enable) => {
- files.stdin?.setRaw?.(enable);
+ io.stdin?.setRaw?.(enable);
stdin._isRawMode = enable;
return stdin;
};