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
4 months ago (0.1.0)
Package root>src>createWritable.ts
/** * Creates a writable stream from a given write function. Every chunk written to the stream will be passed to the function. * * @param fn The write function, that will be called for each chunk written to the stream * @returns A writable stream * * @example const logStream = createWritable(console.log); */ export const createWritable = <T>(fn: (chunk: T) => void | Promise<void>): WritableStream<T> => { return new WritableStream<T>({ write: fn }) }