1 | /// <reference types="node" />
|
2 | import { Reviver } from '@naturalcycles/js-lib';
|
3 | import { TransformTyped } from '../stream.model';
|
4 | export 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 | */
|
26 | export declare function transformJsonParse<OUT = Record<string, any>>(opt?: TransformJsonParseOptions): TransformTyped<string | Buffer, OUT>;
|
27 | export declare const bufferReviver: Reviver;
|