@naturalcycles/nodejs-lib
Version:
Standard library for Node.js
28 lines (27 loc) • 745 B
TypeScript
import { TransformTyped } from '../stream.model';
export interface TransformToNDJsonOptions {
/**
* If true - will throw an error on JSON.parse / stringify error
*
* @default true
*/
strict?: boolean;
/**
* If true - will run `sortObjectDeep()` on each object to achieve deterministic sort
*
* @default false
*/
sortObjects?: boolean;
/**
* @default `\n`
*/
separator?: string;
/**
* @experimental
*/
useFlatstr?: boolean;
}
/**
* Transforms objects (objectMode=true) into chunks \n-terminated JSON strings (readableObjectMode=false).
*/
export declare function transformToNDJson<IN = any>(opt?: TransformToNDJsonOptions): TransformTyped<IN, string>;