sflow
Version:
sflow is a powerful and highly-extensible library designed for processing and manipulating streams of data effortlessly. Inspired by the functional programming paradigm, it provides a rich set of utilities for transforming streams, including chunking, fil
20 lines • 1.07 kB
TypeScript
import type { Awaitable } from "./Awaitable";
export type ChunkTransformer<T> = (chunks: T[], ctrl: TransformStreamDefaultController<T>) => Awaitable<T[]>;
/**
* Creates a TransformStream that processes chunks using provided transformers.
*
* @template T - The type of chunk that the TransformStream will process.
*
* @param {Object} options - The options object containing transformer functions.
* @param {ChunkTransformer<T>} [options.start] - The transformer function to run when the stream is started.
* @param {ChunkTransformer<T>} [options.transform] - The transformer function to run for each chunk, current chunk will be the last element.
* @param {ChunkTransformer<T>} [options.flush] - The transformer function to run when the stream is flushed.
*
* @returns A new TransformStream that applies the provided transformers.
*/
export declare function chunkTransforms<T>(options: {
start?: ChunkTransformer<T>;
transform?: ChunkTransformer<T>;
flush?: ChunkTransformer<T>;
}): TransformStream<T, T>;
//# sourceMappingURL=chunkTransforms.d.ts.map