@naturalcycles/nodejs-lib
Version:
Standard library for Node.js
28 lines (27 loc) • 814 B
TypeScript
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;