process.stdout


process.stdout 属性返回连接到 stdout (文件描述符 1) 的流。 它是 net.Socket(也就是 Duplex 流),除非文件描述符 1 指向文件,在这种情况下它是 Writable 流。

例如,要将 process.stdin 复制到 process.stdout

import { stdin, stdout } from 'node:process';

stdin.pipe(stdout);const { stdin, stdout } = require('node:process');

stdin.pipe(stdout);

process.stdout 在一些重要的方面不同于其他 Node.js 流。 有关更多信息,请参阅进程 I/O 的注意事项

The process.stdout property returns a stream connected to stdout (fd 1). It is a net.Socket (which is a Duplex stream) unless fd 1 refers to a file, in which case it is a Writable stream.

For example, to copy process.stdin to process.stdout:

import { stdin, stdout } from 'node:process';

stdin.pipe(stdout);const { stdin, stdout } = require('node:process');

stdin.pipe(stdout);

process.stdout differs from other Node.js streams in important ways. See note on process I/O for more information.