Skip to main content

@std/streams@0.215.0

latest
Works with
It is unknown whether this package works with Node.js, Deno, Browsers, Cloudflare Workers, Bun
It is unknown whether this package works with Node.js
It is unknown whether this package works with Deno
It is unknown whether this package works with Browsers
It is unknown whether this package works with Cloudflare Workers
It is unknown whether this package works with Bun
JSR Score70%
Published2 years ago (0.215.0)

Classes

c
Buffer(ab?: ArrayBufferLike | ArrayLike<number>)

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 n bytes. After .grow(n), at least n bytes can be written to the buffer without another allocation. If n is 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 n unread bytes from the buffer but continues to use the same allocated storage. It throws if n is negative or greater than the length of the buffer.

  • writable(): WritableStream<Uint8Array>

    Getter returning the instance's WritableStream.

Report package

Please provide a reason for reporting this package. We will review your report and take appropriate action.

Please review the JSR usage policy before submitting a report.

Add Package

deno add jsr:@std/streams

Import symbol

import * as mod from "@std/streams/buffer";
or

Import directly with a jsr specifier

import * as mod from "jsr:@std/streams/buffer";