UNPKG

939 BTypeScriptView Raw
1/// <reference types="node" />
2import { ZlibOptions } from 'zlib';
3import { NDJsonStats } from './ndjson.model';
4import { TransformToNDJsonOptions } from './transformToNDJson';
5export interface PipelineToNDJsonFileOptions extends TransformToNDJsonOptions {
6 filePath: string;
7 /**
8 * @default false
9 * If true - will fail if output file already exists.
10 */
11 protectFromOverwrite?: boolean;
12 /**
13 * @default false
14 */
15 gzip?: boolean;
16 /**
17 * Only applicable if `gzip` is enabled
18 */
19 zlibOptions?: ZlibOptions;
20}
21/**
22 * Convenience pipeline to transform stream of objects into a file in NDJSON format.
23 *
24 * Does fs.ensureFile() before starting, which will create all needed directories and truncate the file if it existed.
25 */
26export declare function pipelineToNDJsonFile(streams: (NodeJS.ReadableStream | NodeJS.WritableStream)[], opt: PipelineToNDJsonFileOptions): Promise<NDJsonStats>;