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)
function earlyZipReadableStreams
earlyZipReadableStreams<T>(...streams: ReadableStream<T>[]): ReadableStream<T>

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.

Examples

Example 1

import { earlyZipReadableStreams } from "@std/streams/early_zip_readable_streams";

const stream1 = ReadableStream.from(["1", "2", "3"]);
const stream2 = ReadableStream.from(["a", "b", "c"]);
const zippedStream = earlyZipReadableStreams(stream1, stream2);

await Array.fromAsync(zippedStream); // ["1", "a", "2", "b", "3", "c"];

Type Parameters

Parameters

...streams: ReadableStream<T>[]

Return Type

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

Import directly with a jsr specifier

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