process.stdout
A writable stream connected to standard output.
Syntax
process.stdout.write(chunk) Parameters
| Name | Type | Required | Description |
|---|---|---|---|
chunk | string | Buffer | Yes | The data to write to stdout. |
Returns
boolean — false if the buffer is full and you should wait for drain.
Examples
process.stdout.write('progress: ');
process.stdout.write('50%\n');
Output
progress: 50%
if (process.stdout.isTTY) {
console.log('interactive terminal,', process.stdout.columns, 'cols');
}
Output
interactive terminal, 120 cols
Notes
Unlike `console.log`, `write` adds no newline and does not format
objects. `stdout` is synchronous for files/TTYs but async for pipes.
Check `isTTY` before emitting ANSI color codes so piped output stays
clean.