UNPKG

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