Skip to main content

@std/streams@0.215.0

latest
Works with
It is unknown whether this package works with Browsers, Deno, Node.js, Cloudflare Workers, Bun
It is unknown whether this package works with Browsers
It is unknown whether this package works with Deno
It is unknown whether this package works with Node.js
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)
class LimitedBytesTransformStream

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.

If options.error is set, then instead of terminating the stream, an error will be thrown.

Examples

Example 1

import { LimitedBytesTransformStream } from "@std/streams/limited_bytes_transform_stream";

const res = await fetch("https://example.com");
const parts = res.body!
  .pipeThrough(new LimitedBytesTransformStream(512 * 1024));

Constructors

new LimitedBytesTransformStream(
size: number,
options?: { error?: boolean; }
)

Constructs a new instance.

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 { LimitedBytesTransformStream } from "@std/streams";
or

Import directly with a jsr specifier

import { LimitedBytesTransformStream } from "jsr:@std/streams";