Streams
Manage data streams, queuing strategies, and transformations. Handle data in chunks, process large datasets, and optimize memory usage.
interface ByteLengthQueuingStrategy
Properties
highWaterMark: number size: QueuingStrategySize<ArrayBufferView> variable ByteLengthQueuingStrategy
The constructor object for ByteLengthQueuingStrategy, used to create a queuing strategy that measures each chunk by its byteLength toward the stream's high water mark.
Properties
prototype: ByteLengthQueuingStrategy interface CompressionStream
An API for compressing a stream of data.
Examples
await Deno.stdin.readable
.pipeThrough(new CompressionStream("gzip"))
.pipeTo(Deno.stdout.writable);
Properties
readable: ReadableStream<Uint8Array<ArrayBuffer>> writable: WritableStream<BufferSource> variable CompressionStream
An API for compressing a stream of data.
Examples
await Deno.stdin.readable
.pipeThrough(new CompressionStream("gzip"))
.pipeTo(Deno.stdout.writable);
Properties
prototype: CompressionStream interface CountQueuingStrategy
This Streams API interface provides a built-in byte length queuing strategy that can be used when constructing streams.
Properties
highWaterMark: number size: QueuingStrategySize variable CountQueuingStrategy
The constructor object for CountQueuingStrategy, used to create a queuing strategy that counts each chunk as a single unit toward the stream's high water mark.
Properties
prototype: CountQueuingStrategy interface DecompressionStream
An API for decompressing a stream of data.
Examples
const input = await Deno.open("./file.txt.gz");
const output = await Deno.create("./file.txt");
await input.readable
.pipeThrough(new DecompressionStream("gzip"))
.pipeTo(output.writable);
Properties
readable: ReadableStream<Uint8Array<ArrayBuffer>> writable: WritableStream<BufferSource> variable DecompressionStream
An API for decompressing a stream of data.
Examples
const input = await Deno.open("./file.txt.gz");
const output = await Deno.create("./file.txt");
await input.readable
.pipeThrough(new DecompressionStream("gzip"))
.pipeTo(output.writable);
Properties
prototype: DecompressionStream interface GenericTransformStream
Properties
readable: ReadableStream writable: WritableStream interface QueuingStrategy
Type Parameters
T = any Properties
highWaterMark: number size: QueuingStrategySize<T> interface QueuingStrategyInit
Properties
highWaterMark: number interface QueuingStrategySize
Type Parameters
T = any Call Signatures
(chunk: T): number interface ReadableByteStreamController
Properties
byobRequest: ReadableStreamBYOBRequest | null desiredSize: number | null Methods
variable ReadableByteStreamController
The constructor object for ReadableByteStreamController.
Instances are passed to a byte-oriented ReadableStream's underlying source callbacks rather than constructed directly, so calling the constructor throws.
Properties
prototype: ReadableByteStreamController interface ReadableStream
This Streams API interface represents a readable stream of byte data. The Fetch API offers a concrete instance of a ReadableStream through the body property of a Response object.
Type Parameters
R = any Properties
locked: boolean Methods
cancel(reason?: any): Promise<void> getReader(options: { mode: "byob"; }): ReadableStreamBYOBReader getReader(options?: ReadableStreamGetReaderOptions): ReadableStreamReader<R> pipeThrough<T>(
transform: ReadableWritablePair<T, R>,
options?: StreamPipeOptions,
): ReadableStream<T> pipeTo(
destination: WritableStream<R>,
options?: StreamPipeOptions,
): Promise<void> tee(): [ReadableStream<R>, ReadableStream<R>] values(options?: ReadableStreamIteratorOptions): AsyncIterableIterator<R> [[Symbol.asyncIterator]](options?: ReadableStreamIteratorOptions): AsyncIterableIterator<R> variable ReadableStream
The constructor object for ReadableStream, used to create a readable stream from an underlying source describing how data is enqueued and consumed.
Properties
prototype: ReadableStream Methods
from<R>(asyncIterable: AsyncIterable<R> | Iterable<R | PromiseLike<R>> & object): ReadableStream<R> interface ReadableStreamBYOBReader
Methods
read<T extends ArrayBufferView>(
view: T,
options?: ReadableStreamBYOBReaderReadOptions,
): Promise<ReadableStreamReadResult<T>> releaseLock(): void variable ReadableStreamBYOBReader
The constructor object for ReadableStreamBYOBReader, used to create a "bring your own buffer" reader locked to the given byte stream. Most code obtains one via ReadableStream.getReader({ mode: "byob" }) instead.
Properties
prototype: ReadableStreamBYOBReader interface ReadableStreamBYOBReaderReadOptions
Properties
min: number interface ReadableStreamBYOBRequest
Properties
view: Uint8Array<ArrayBuffer> | null Methods
respond(bytesWritten: number): void respondWithNewView(view: ArrayBufferView): void variable ReadableStreamBYOBRequest
The constructor object for ReadableStreamBYOBRequest.
Instances are provided to a byte stream's controller rather than constructed directly, so calling the constructor throws.
Properties
prototype: ReadableStreamBYOBRequest interface ReadableStreamDefaultController
variable ReadableStreamDefaultController
The constructor object for ReadableStreamDefaultController.
Instances are passed to a ReadableStream's underlying source callbacks rather than constructed directly, so calling the constructor throws.
Properties
prototype: ReadableStreamDefaultController interface ReadableStreamDefaultReader
Type Parameters
R = any Methods
read(): Promise<ReadableStreamReadResult<R>> releaseLock(): void variable ReadableStreamDefaultReader
The constructor object for ReadableStreamDefaultReader, used to create a default reader locked to the given ReadableStream. Most code obtains one via ReadableStream.getReader instead.
Properties
prototype: ReadableStreamDefaultReader interface ReadableStreamGenericReader
interface ReadableStreamGetReaderOptions
Properties
mode: ReadableStreamReaderMode interface ReadableStreamIteratorOptions
Properties
preventCancel: boolean interface ReadableStreamReadDoneResult
interface ReadableStreamReadValueResult
interface ReadableWritablePair
Type Parameters
R = any W = any Properties
interface StreamPipeOptions
Properties
preventAbort: boolean preventCancel: boolean preventClose: boolean signal: AbortSignal interface Transformer
Type Parameters
I = any O = any Properties
flush: TransformerFlushCallback<O> readableType: undefined start: TransformerStartCallback<O> transform: TransformerTransformCallback<I, O> cancel: TransformerCancelCallback writableType: undefined interface TransformerCancelCallback
Call Signatures
(reason: any): void | PromiseLike<void> interface TransformerFlushCallback
Type Parameters
O Call Signatures
(controller: TransformStreamDefaultController<O>): void | PromiseLike<void> interface TransformerStartCallback
Type Parameters
O Call Signatures
(controller: TransformStreamDefaultController<O>): any interface TransformerTransformCallback
Type Parameters
I O Call Signatures
(
chunk: I,
controller: TransformStreamDefaultController<O>,
): void | PromiseLike<void> interface TransformStream
Type Parameters
I = any O = any Properties
readable: ReadableStream<O> writable: WritableStream<I> variable TransformStream
The constructor object for TransformStream, used to create a transform stream from a transformer describing how chunks read from its writable side are transformed before appearing on its readable side.
Properties
prototype: TransformStream interface TransformStreamDefaultController
variable TransformStreamDefaultController
The constructor object for TransformStreamDefaultController.
Instances are passed to a TransformStream's transformer callbacks rather than constructed directly, so calling the constructor throws.
Properties
prototype: TransformStreamDefaultController interface UnderlyingByteSource
Properties
autoAllocateChunkSize: number cancel: UnderlyingSourceCancelCallback pull: (controller: ReadableByteStreamController) => void | PromiseLike<void> start: (controller: ReadableByteStreamController) => any type: "bytes" interface UnderlyingDefaultSource
Type Parameters
R = any Properties
cancel: UnderlyingSourceCancelCallback pull: (controller: ReadableStreamDefaultController<R>) => void | PromiseLike<void> start: (controller: ReadableStreamDefaultController<R>) => any type: undefined interface UnderlyingSink
Type Parameters
W = any Properties
abort: UnderlyingSinkAbortCallback close: UnderlyingSinkCloseCallback start: UnderlyingSinkStartCallback type: undefined write: UnderlyingSinkWriteCallback<W> interface UnderlyingSinkAbortCallback
Call Signatures
(reason?: any): void | PromiseLike<void> interface UnderlyingSinkCloseCallback
Call Signatures
(): void | PromiseLike<void> interface UnderlyingSinkStartCallback
Call Signatures
(controller: WritableStreamDefaultController): any interface UnderlyingSinkWriteCallback
Type Parameters
W Call Signatures
(
chunk: W,
controller: WritableStreamDefaultController,
): void | PromiseLike<void> interface UnderlyingSource
Type Parameters
R = any Properties
autoAllocateChunkSize: number cancel: UnderlyingSourceCancelCallback pull: UnderlyingSourcePullCallback<R> start: UnderlyingSourceStartCallback<R> type: ReadableStreamType interface UnderlyingSourceCancelCallback
Call Signatures
(reason?: any): void | PromiseLike<void> interface UnderlyingSourcePullCallback
Type Parameters
R Call Signatures
(controller: ReadableStreamController<R>): void | PromiseLike<void> interface UnderlyingSourceStartCallback
Type Parameters
R Call Signatures
(controller: ReadableStreamController<R>): any interface WritableStream
This Streams API interface provides a standard abstraction for writing streaming data to a destination, known as a sink. This object comes with built-in backpressure and queuing.
Type Parameters
W = any Properties
locked: boolean Methods
variable WritableStream
The constructor object for WritableStream, used to create a writable stream from an underlying sink describing how written chunks are handled.
Properties
prototype: WritableStream interface WritableStreamDefaultController
This Streams API interface represents a controller allowing control of a WritableStream's state. When constructing a WritableStream, the underlying sink is given a corresponding WritableStreamDefaultController instance to manipulate.
Properties
signal: AbortSignal Methods
error(e?: any): void variable WritableStreamDefaultController
The constructor object for WritableStreamDefaultController.
Instances are passed to a WritableStream's underlying sink callbacks rather than constructed directly, so calling the constructor throws.
Properties
prototype: WritableStreamDefaultController interface WritableStreamDefaultWriter
This Streams API interface is the object returned by WritableStream.getWriter() and once created locks the < writer to the WritableStream ensuring that no other streams can write to the underlying sink.
Type Parameters
W = any Properties
Methods
variable WritableStreamDefaultWriter
The constructor object for WritableStreamDefaultWriter, used to create a writer locked to the given WritableStream. Most code obtains one via WritableStream.getWriter instead.
Properties
prototype: WritableStreamDefaultWriter type alias CompressionFormat
Definition
"deflate"
| "deflate-raw"
| "gzip"
| "brotli"
type alias ReadableStreamController
Type Parameters
T Definition
type alias ReadableStreamReader
Type Parameters
T Definition
type alias ReadableStreamReaderMode
Definition
"byob" type alias ReadableStreamReadResult
Type Parameters
T Definition
type alias ReadableStreamType
Definition
"bytes"
© 2018–2025 the Deno authors
Licensed under the MIT License.
https://docs.deno.com/api/web/streams