UNPKG

835 BTypeScriptView Raw
1/// <reference types="node" />
2import { Reviver } from '@naturalcycles/js-lib';
3import { TransformTyped } from '../stream.model';
4export interface TransformJsonParseOptions {
5 /**
6 * @default true
7 * If true - will throw an error on JSON.parse / stringify error
8 */
9 strict?: boolean;
10 reviver?: Reviver;
11}
12/**
13 * Transforms chunks of JSON strings/Buffers (objectMode=false) into parsed objects (readableObjectMode=true).
14 *
15 * if strict - will throw an error on JSON.parse / stringify error
16 *
17 * Usage:
18 *
19 * await _pipeline([
20 * readable,
21 * binarySplit(),
22 * transformJsonParse(),
23 * consumeYourStream...
24 * [)
25 */
26export declare function transformJsonParse<OUT = Record<string, any>>(opt?: TransformJsonParseOptions): TransformTyped<string | Buffer, OUT>;
27export declare const bufferReviver: Reviver;