UNPKG

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