Skip to main content

Built and signed on GitHub Actions

This package works with Node.js, DenoIt is unknown whether this package works with Cloudflare Workers, Bun, Browsers
It is unknown whether this package works with Cloudflare Workers
This package works with Node.js
This package works with Deno
It is unknown whether this package works with Bun
It is unknown whether this package works with Browsers
JSR Score
94%
Published
3 days ago (0.1.0)
function createReadable
createReadable<T extends Iterable<unknown> | AsyncIterable<unknown>>(iterable: T): IReadable<T>

Creates a readable stream from an iterable. Every item in the iterable will be a chunk in the stream. This way you can pipe the stream, transform it, etc.

Examples

Example 1

const numsStream = createReadable([1, 2, 3, 4, 5]);

Example 2

const numsStream = createReadable((async function* () { yield 1; yield 2; yield 3; })());

Example 3

const numsStream = createReadable(new Set([1, 2, 3, 4, 5]));

Example 4

const numsStream = createReadable('12345');

Type Parameters

T extends Iterable<unknown> | AsyncIterable<unknown>

Parameters

iterable: T

Anything that is iterable, like an array, a generator, a string, etc.

Return Type

IReadable<T>

A readable stream

Add Package

deno add jsr:@sgmonda/qfu

Import symbol

import { createReadable } from "@sgmonda/qfu";

---- OR ----

Import directly with a jsr specifier

import { createReadable } from "jsr:@sgmonda/qfu";

Add Package

npx jsr add @sgmonda/qfu

Import symbol

import { createReadable } from "@sgmonda/qfu";

Add Package

yarn dlx jsr add @sgmonda/qfu

Import symbol

import { createReadable } from "@sgmonda/qfu";

Add Package

pnpm dlx jsr add @sgmonda/qfu

Import symbol

import { createReadable } from "@sgmonda/qfu";

Add Package

bunx jsr add @sgmonda/qfu

Import symbol

import { createReadable } from "@sgmonda/qfu";