UNPKG

@naturalcycles/nodejs-lib

Version:
28 lines (27 loc) 814 B
import type { Reviver } from '@naturalcycles/js-lib/types'; import type { TransformTyped } from '../stream.model.js'; export interface TransformJsonParseOptions { /** * If true - will throw an error on JSON.parse / stringify error * * @default true */ strict?: boolean; reviver?: Reviver; } /** * Transforms chunks of JSON strings/Buffers (objectMode=false) into parsed objects (readableObjectMode=true). * * if strict - will throw an error on JSON.parse / stringify error * * Usage: * * await _pipeline([ * readable, * binarySplit(), * transformJsonParse(), * consumeYourStream... * [) */ export declare function transformJsonParse<ROW = any>(opt?: TransformJsonParseOptions): TransformTyped<string | Buffer, ROW>; export declare const bufferReviver: Reviver;