superagent-jsonparse
Provide a streaming parser for superagent based on jsonparse.
Installation
npm install superagent-jsonparse
yarn add superagent-jsonparse
Usage
const request = ;const jsonParser = ;const Decimal = ; body = await request accept'json' // body contains arbitrary-precision Decimal for all JSON numbers
Description
This package is a superagent plugin which replaces the default JSON parser (JSON.parse
) with a streaming parser.
Optionally, you may provide a reviver for parsed numbers, which allows to implement arbitray-precision (big-number, big-decimal) parsing of JSON numbers. The default reviver for numbers is (text) => new Number(text)
, which provides functionality similar to JSON.parse
.