UNPKG

@naturalcycles/nodejs-lib

Version:
14 lines (13 loc) 646 B
import type { NonNegativeInteger, Predicate } from '@naturalcycles/js-lib/types'; import { Pipeline } from '../pipeline.js'; import type { TransformOptions, WritableTyped } from '../stream.model.js'; /** * Allows to "split the stream" into chunks, and attach a new Pipeline to * each of the chunks. * * Example use case: you want to write to Cloud Storage, 1000 rows per file, * each file needs its own destination Pipeline. * * @experimental */ export declare function writableChunk<T>(splitPredicate: Predicate<T>, fn: (pipeline: Pipeline<T>, splitIndex: NonNegativeInteger) => Promise<void>, opt?: TransformOptions): WritableTyped<T>;