@naturalcycles/nodejs-lib
Version:
Standard library for Node.js
29 lines (28 loc) • 826 B
TypeScript
/// <reference types="node" />
import { Reviver } from '@naturalcycles/js-lib';
import { TransformTyped } from '../stream.model';
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<OUT = any>(opt?: TransformJsonParseOptions): TransformTyped<string | Buffer, OUT>;
export declare const bufferReviver: Reviver;