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:
const stream = require('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 is
primarily for examples and testing, but there are some use cases wherestream.PassThrough is useful as a building block for novel sorts of streams.
Transform streams are Duplex streams where the output is in some way
related to the input. Like all Duplex streams, Transform streams
implement 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 is
primarily for examples and testing, but there are some use cases wherestream.PassThrough is useful as a building block for novel sorts of streams.
Transform streams are Duplex streams where the output is in some way
related to the input. Like all Duplex streams, Transform streams
implement both the Readable and Writable interfaces.
A stream to attach a signal to.
A readable and/or writable stream/webstream.
Returns the default highWaterMark used by streams.
Defaults to 16384 (16 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 and properly 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.
A readable and/or writable stream/webstream.
Returns the default highWaterMark used by streams.
Defaults to 16384 (16 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 and properly cleaning up and provide a callback when the pipeline is complete.
Sets the default highWaterMark used by streams.