@naturalcycles/nodejs-lib
Version:
Standard library for Node.js
25 lines (24 loc) • 705 B
TypeScript
/// <reference types="node" />
import { TransformTyped } from '../stream.model';
export interface TransformJsonParseOptions {
/**
* @default true
* If true - will throw an error on JSON.parse / stringify error
*/
strict?: boolean;
}
/**
* 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 = object>(opt?: TransformJsonParseOptions): TransformTyped<string | Buffer, OUT>;