Skip to main content
stream - Node documentation

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.

Classes

c
N
default
No documentation available
c
default.PassThrough

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 where stream.PassThrough is useful as a building block for novel sorts of streams.

c
default.Readable
No documentation available
c
default.Stream
No documentation available
c
default.Transform

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.

c
default.Writable
No documentation available
c
N
internal
No documentation available
c
internal.PassThrough

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 where stream.PassThrough is useful as a building block for novel sorts of streams.

c
internal.Readable
No documentation available
c
internal.Stream
No documentation available
c
internal.Transform

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.

c
internal.Writable
No documentation available

Functions

f
default.addAbortSignal

A stream to attach a signal to.

f
default.duplexPair

The utility function duplexPair returns an Array with two items, each being a Duplex stream connected to the other side:

f
N
default.finished

A readable and/or writable stream/webstream.

f
default.finished.__promisify__
No documentation available
f
default.getDefaultHighWaterMark

Returns the default highWaterMark used by streams. Defaults to 65536 (64 KiB), or 16 for objectMode.

f
default.isErrored

Returns whether the stream has encountered an error.

f
default.isReadable

Returns whether the stream is readable.

f
N
default.pipeline

A module method to pipe between streams and generators forwarding errors and properly cleaning up and provide a callback when the pipeline is complete.

f
default.pipeline.__promisify__
No documentation available
f
default.setDefaultHighWaterMark

Sets the default highWaterMark used by streams.

f
internal.addAbortSignal

A stream to attach a signal to.

f
internal.duplexPair

The utility function duplexPair returns an Array with two items, each being a Duplex stream connected to the other side:

f
N
internal.finished

A readable and/or writable stream/webstream.

f
internal.finished.__promisify__
No documentation available
f
internal.getDefaultHighWaterMark

Returns the default highWaterMark used by streams. Defaults to 65536 (64 KiB), or 16 for objectMode.

f
internal.isErrored

Returns whether the stream has encountered an error.

f
internal.isReadable

Returns whether the stream is readable.

f
N
internal.pipeline

A module method to pipe between streams and generators forwarding errors and properly cleaning up and provide a callback when the pipeline is complete.

f
internal.pipeline.__promisify__
No documentation available
f
internal.setDefaultHighWaterMark

Sets the default highWaterMark used by streams.

Interfaces

I
ArrayOptions
No documentation available
I
I
default.Pipe
No documentation available
I
default.PipelineOptions
No documentation available
I
default.ReadableOptions
No documentation available
I
I
internal.Pipe
No documentation available
I
internal.PipelineOptions
No documentation available
I
internal.ReadableOptions
No documentation available

Type Aliases

T
ComposeFnParam
No documentation available
T
default.PipelineCallback
No documentation available
T
default.PipelineDestination
No documentation available
T
T
default.PipelineDestinationPromiseFunction
No documentation available
T
default.PipelinePromise
No documentation available
T
default.PipelineSource
No documentation available
T
default.PipelineSourceFunction
No documentation available
T
default.PipelineTransform
No documentation available
T
default.PipelineTransformSource
No documentation available
T
default.TransformCallback
No documentation available
T
internal.PipelineCallback
No documentation available
T
internal.PipelineDestination
No documentation available
T
T
T
internal.PipelinePromise
No documentation available
T
internal.PipelineSource
No documentation available
T
internal.PipelineSourceFunction
No documentation available
T
internal.PipelineTransform
No documentation available
T
internal.PipelineTransformSource
No documentation available
T
internal.TransformCallback
No documentation available

Variables

v
default.consumers
No documentation available
v
default.promises
No documentation available
v
internal.consumers
No documentation available
v
internal.promises
No documentation available