Stream
Default character encoding applied to read chunks. @compat elide Full
Module: node:stream
Support: Experimental
7 members: 5 supported, 2 undocumented
Properties
🟢 Readable
An abstract readable stream — the source side of a stream pipeline.
🟢 Writable
Detaches the stream from the given writable destination, or all destinations.
🟢 Duplex
A stream that is both Readable and Writable (e.g. a TCP socket or zlib stream).
🟢 Transform
A Duplex stream that applies a transformation to data as it passes through.
🟢 PassThrough
A Transform stream that passes all data through unchanged.
⚪ pipeline
The PassThrough stream class. @compat elide Full
⚪ finished
Promise-based pipeline() utility for composing stream pipelines with error propagation. @compat elide Full
Dictionary ReadableOptions
Options for constructing a Readable stream.
Since: 1.1.0
Docs: Node.js Docs
6 members: 6 undocumented
Properties
⚪ highWaterMark
Internal buffer size in bytes (or object count in object mode). @compat elide Full
⚪ encoding
Internal buffer size in bytes (or object count in object mode). @compat elide Full
⚪ objectMode
If true, the stream operates on arbitrary JS objects instead of Buffers. @compat elide Full
⚪ emitClose
If true, emits a "close" event when destroyed (default: true). @compat elide Full
⚪ autoDestroy
If true, automatically destroys the stream when it ends (default: true). @compat elide Full
⚪ signal
An AbortSignal that can be used to cancel the stream. @compat elide Full
---
Dictionary WritableOptions
Options for constructing a Writable stream.
Since: 1.1.0
Docs: Node.js Docs
7 members: 7 undocumented
Properties
⚪ highWaterMark
Internal buffer size in bytes (or object count in object mode). @compat elide Full
⚪ decodeStrings
If true, string chunks are decoded to Buffers before passing to _write (default: true). @compat elide Full
⚪ defaultEncoding
Default encoding when write() is called with a string (default: "utf8"). @compat elide Full
⚪ objectMode
If true, the stream operates on arbitrary JS objects instead of Buffers. @compat elide Full
⚪ emitClose
If true, emits a "close" event when destroyed (default: true). @compat elide Full
⚪ autoDestroy
If true, automatically destroys the stream when it ends (default: true). @compat elide Full
⚪ signal
An AbortSignal that can be used to cancel the stream. @compat elide Full
---
Interface Readable
An abstract readable stream — the source side of a stream pipeline.
Emits "data", "end", "error", and "close" events.
Extends: EventEmitter
Since: 1.1.0
Docs: Node.js Docs
20 members: 10 supported, 10 undocumented
Constructors
🟢 constructor(options)
Creates a new Readable stream with the given options.
Methods
⚪ read(size)
Internal buffer size in bytes (or object count in object mode). @compat elide Full
⚪ setEncoding(encoding)
True if the stream was created in object mode. @compat elide Full
⚪ pause()
Pauses the stream, stopping it from emitting "data" events until resume() is called. @compat elide Full
🟢 resume()
Sets the default character encoding for data events.
🟢 isPaused()
Returns true if the stream is currently paused.
🟢 unpipe(destination)
Detaches the stream from the given writable destination, or all destinations.
🟢 unshift(chunk, encoding)
Pushes a chunk back to the front of the read buffer.
🟢 wrap(stream)
Wraps an old-style (non-stream2) stream as a Readable.
🟢 push(chunk, encoding)
Pushes a chunk into the stream's internal buffer.
🟢 destroy(error, callback)
Destroys the stream with an optional error and optional callback.
🟢 pipe(destination, options)
Pipes data from this Readable into a Writable destination.
Properties
🟢 readable
Creates a new Readable stream with the given options.
⚪ readableEnded
True if the stream has ended and all data has been consumed. @compat elide Full
⚪ readableFlowing
The current flow state: null (initial), false (paused explicitly), or true (flowing). @compat elide Full
⚪ readableHighWaterMark
The high-water mark in bytes (or objects) used for this stream. @compat elide Full
⚪ readableLength
Number of bytes (or objects) currently in the internal read buffer. @compat elide Full
⚪ readableObjectMode
True if the stream was created in object mode. @compat elide Full
⚪ readableEncoding
The current character encoding set via setEncoding(), or null. @compat elide Full
⚪ destroyed
If true, the stream operates on arbitrary JS objects instead of Buffers. @compat elide Full
---
Interface Writable
Detaches the stream from the given writable destination, or all destinations.
Extends: EventEmitter
15 members: 4 supported, 11 undocumented
Constructors
🟢 constructor(options)
Creates a new Readable stream with the given options.
Methods
⚪ write(chunk, encoding, callback)
If true, string chunks are decoded to Buffers before passing to _write (default: true). @compat elide Full
⚪ end(chunk, encoding, callback)
True if the stream is still writable (not ended or destroyed). @compat elide Full
⚪ cork()
True if the stream was created in object mode. @compat elide Full
⚪ uncork()
True if the stream was created in object mode. @compat elide Full
🟢 destroy(error, callback)
Destroys the stream with an optional error and optional callback.
🟢 setDefaultEncoding(encoding)
Sets the default encoding for string chunks passed to write().
Properties
🟢 writable
Creates a new Writable stream with the given options.
⚪ writableEnded
True if end() has been called. @compat elide Full
⚪ writableFinished
True if the stream has been fully flushed and "finish" has been emitted. @compat elide Full
⚪ writableHighWaterMark
The high-water mark in bytes (or objects) used for this stream. @compat elide Full
⚪ writableLength
Number of bytes (or objects) currently buffered for writing. @compat elide Full
⚪ writableObjectMode
True if the stream was created in object mode. @compat elide Full
⚪ writableCorked
True if cork() has been called and uncork() has not yet been called. @compat elide Full
⚪ destroyed
If true, the stream operates on arbitrary JS objects instead of Buffers. @compat elide Full
---
Interface Duplex
A stream that is both Readable and Writable (e.g. a TCP socket or zlib stream).
The readable and writable sides operate independently of each other.
Extends: Readable
Since: 1.1.0
Docs: Node.js Docs
13 members: 3 supported, 10 undocumented
Constructors
🟢 constructor(options)
Creates a new Readable stream with the given options.
Methods
⚪ write(chunk, encoding, callback)
If true, string chunks are decoded to Buffers before passing to _write (default: true). @compat elide Full
⚪ end(chunk, encoding, callback)
True if the stream is still writable (not ended or destroyed). @compat elide Full
⚪ cork()
True if the stream was created in object mode. @compat elide Full
⚪ uncork()
True if the stream was created in object mode. @compat elide Full
🟢 setDefaultEncoding(encoding)
Sets the default encoding for string chunks passed to write().
Properties
🟢 writable
Creates a new Writable stream with the given options.
⚪ writableEnded
True if end() has been called. @compat elide Full
⚪ writableFinished
True if the stream has been fully flushed and "finish" has been emitted. @compat elide Full
⚪ writableHighWaterMark
The high-water mark in bytes (or objects) used for this stream. @compat elide Full
⚪ writableLength
Number of bytes (or objects) currently buffered for writing. @compat elide Full
⚪ writableObjectMode
True if the stream was created in object mode. @compat elide Full
⚪ writableCorked
True if cork() has been called and uncork() has not yet been called. @compat elide Full
---
A Duplex stream that applies a transformation to data as it passes through.
Implement _transform() to define the transformation logic.
Extends: Duplex
Since: 1.1.0
Docs: Node.js Docs
Constructors
🟢 constructor(options)
Creates a new Readable stream with the given options.
---
Interface PassThrough
A Transform stream that passes all data through unchanged.
Useful as a placeholder or for attaching event listeners in a pipeline.
Extends: Transform
Since: 1.1.0
Docs: Node.js Docs
Constructors
🟢 constructor(options)
Creates a new Readable stream with the given options.
---