stream-chain
Version:
Chain functions, generators, Node streams, and Web streams into a pipeline with backpressure support.
20 lines (16 loc) • 517 B
TypeScript
/// <reference types="node" />
import {DuplexOptions} from 'node:stream';
import {TypedDuplex} from './typed-streams.js';
import {Arg0, Ret} from './defs.js';
/**
* Wraps a function in a duplex stream
* @param fn function to wrap
* @param options options for the wrapping duplex stream
* @returns a duplex stream
*/
declare function asStream<F extends (chunk: any, encoding?: string) => unknown>(
fn: F,
options?: DuplexOptions
): TypedDuplex<Arg0<F>, Ret<F>>;
export default asStream;
export {asStream};