Usage in Deno
import * as mod from "node:stream";
A stream is an abstract interface for working with streaming data in Node.js.
The node:stream module provides an API for implementing the stream interface.
There are many stream objects provided by Node.js. For instance, a request to an HTTP server
and process.stdout are both stream instances.
Streams can be readable, writable, or both. All streams are instances of EventEmitter.
To access the node:stream module:
import stream from 'node:stream';
The node:stream module is useful for creating new types of stream instances.
It is usually not necessary to use the node:stream module to consume streams.
Duplex streams are streams that implement both the Readable and Writable interfaces.
The stream.PassThrough class is a trivial implementation of a Transform stream that simply passes the input bytes across to the output. Its purpose isprimarily for examples and testing, but there are some use cases where stream.PassThrough is useful as a building block for novel sorts of streams.
Transform streams are Duplex streams where the output is in some wayrelated to the input. Like all Duplex streams, Transform streamsimplement both the Readable and Writable interfaces.
Duplex streams are streams that implement both the Readable and Writable interfaces.
The stream.PassThrough class is a trivial implementation of a Transform stream that simply passes the input bytes across to the output. Its purpose isprimarily for examples and testing, but there are some use cases where stream.PassThrough is useful as a building block for novel sorts of streams.
Transform streams are Duplex streams where the output is in some wayrelated to the input. Like all Duplex streams, Transform streamsimplement both the Readable and Writable interfaces.
- _construct
- _destroy
- _read
- addListener
- asIndexedPairs
- closed
- destroy
- destroyed
- drop
- emit
- errored
- every
- filter
- find
- flatMap
- forEach
- from
- isDisturbed
- isPaused
- iterator
- map
- on
- once
- pause
- prependListener
- prependOnceListener
- push
- read
- readable
- readableAborted
- readableDidRead
- readableEncoding
- readableEnded
- readableFlowing
- readableHighWaterMark
- readableLength
- readableObjectMode
- reduce
- removeListener
- resume
- setEncoding
- some
- take
- toArray
- unpipe
- unshift
- wrap
A stream to attach a signal to.
The utility function duplexPair returns an Array with two items,each being a Duplex stream connected to the other side:
A readable and/or writable stream/webstream.
Returns the default highWaterMark used by streams.Defaults to 65536 (64 KiB), or 16 for objectMode.
Returns whether the stream has encountered an error.
Returns whether the stream is readable.
A module method to pipe between streams and generators forwarding errors andproperly cleaning up and provide a callback when the pipeline is complete.
Sets the default highWaterMark used by streams.
A stream to attach a signal to.
The utility function duplexPair returns an Array with two items,each being a Duplex stream connected to the other side:
A readable and/or writable stream/webstream.
Returns the default highWaterMark used by streams.Defaults to 65536 (64 KiB), or 16 for objectMode.
Returns whether the stream has encountered an error.
Returns whether the stream is readable.
A module method to pipe between streams and generators forwarding errors andproperly cleaning up and provide a callback when the pipeline is complete.
Sets the default highWaterMark used by streams.