- @std/streams
default
- all symbols
- default
- buffer
- byte_slice_stream
- delimiter_stream
- early_zip_readable_streams
- iterate_reader
- limited_bytes_transform_stream
- limited_transform_stream
- merge_readable_streams
- readable_stream_from_reader
- reader_from_iterable
- reader_from_stream_reader
- text_delimiter_stream
- text_line_stream
- to_array_buffer
- to_blob
- to_json
- to_text
- to_transform_stream
- writable_stream_from_writer
- writer_from_stream_writer
- zip_readable_streams
Classes
A variable-sized buffer of bytes with read() and write() methods.
- bytes(options?): Uint8Array
Returns a slice holding the unread portion of the buffer.
- capacity(): number
The read only capacity of the buffer's underlying byte slice, that is, the total space allocated for the buffer's data.
- empty(): boolean
Returns whether the unread portion of the buffer is empty.
- grow(n: number): void
Grows the buffer's capacity, if necessary, to guarantee space for another
nbytes. After.grow(n), at leastnbytes can be written to the buffer without another allocation. Ifnis negative,.grow()will throw. If the buffer can't grow it will throw an error. - length(): number
A read only number of bytes of the unread portion of the buffer.
- readable(): ReadableStream<Uint8Array>
Getter returning the instance's
ReadableStream. - reset(): void
Resets to an empty buffer.
- truncate(n: number): void
Discards all but the first
nunread bytes from the buffer but continues to use the same allocated storage. It throws ifnis negative or greater than the length of the buffer. - writable(): WritableStream<Uint8Array>
Getter returning the instance's
WritableStream.
A transform stream that only transforms from the zero-indexed start and
end bytes (both inclusive).
Divide a stream into chunks delimited by a given byte sequence.
A TransformStream that will only read & enqueue size amount of
bytes. This operation is chunk based and not BYOB based, and as such will
read more than needed.
A TransformStream that will only read & enqueue size amount of
chunks.
Transform a stream into a stream where each chunk is divided by a given delimiter.
Transform a stream into a stream where each chunk is divided by a newline,
be it \n or \r\n. \r can be enabled via the allowCR option.
Functions
Merge multiple streams into a single one, taking order into account, and each stream will wait for a chunk to enqueue before the next stream can append another chunk. If a stream ends before other ones, the others will be cancelled.
Merge multiple streams into a single one, not taking order into account. If a stream ends before other ones, the other will continue adding data, and the finished one will not add any more data.
Converts a ReadableStream of Uint8Arrays to an
ArrayBuffer. Works the same asResponse.arrayBuffer.
Converts a ReadableStream of Uint8Arrays to a
Blob. Works the same as Response.blob.
Converts a JSON-formatted ReadableSteam of strings or
Uint8Arrays to an object. Works the same as
Response.json.
Converts a ReadableSteam of strings or Uint8Arrays
to a single string. Works the same as Response.text.
Convert the generator function into a TransformStream.
Merge multiple streams into a single one, taking order into account, and each stream will wait for a chunk to enqueue before the next stream can append another chunk. If a stream ends before other ones, the others will continue adding data in order, and the finished one will not add any more data.
Turns a Reader, r, into an async iterator.
Turns a ReaderSync, r, into an iterator.
Create a ReadableStream of Uint8Arrays from a
Reader.
Create a Reader from an iterable of Uint8Arrays.
Create a Reader from a ReadableStreamDefaultReader.
Create a WritableStream from a Writer.
Create a Writer from a WritableStreamDefaultWriter.
Interfaces
Options for DelimiterStream.
- disposition: DelimiterDisposition
Disposition of the delimiter.
Options for TextLineStream.
- allowCR: boolean
Allow splitting by
\r.
- autoClose: boolean
If the
readeris also aCloser, automatically close thereaderwhenEOFis encountered, or a read error occurs. - chunkSize: number
The size of chunks to allocate to read, the default is ~16KiB, which is the maximum size that Deno operations can currently support.
- strategy: { highWaterMark?: number | undefined; size?: undefined; }
The queuing strategy to create the
ReadableStreamwith.
- autoClose: boolean
If the
writeris also aCloser, automatically close thewriterwhen the stream is closed, aborted, or a write error occurs.
Type Aliases
Disposition of the delimiter for DelimiterStreamOptions.