@fatcherjs/middleware-json
v3.0.0-alpha-10
Published
<a href="https://npmjs.com/package/@fatcherjs/middleware-json"><img src="https://img.shields.io/npm/v/@fatcherjs/middleware-json.svg" alt="npm package"></a> [![install size](https://packagephobia.com/badge?p=@fatcherjs/middleware-json)](https://packagepho
Downloads
399
Readme
@fatcherjs/middleware-json
Install
NPM
>$ npm install @fatcherjs/middleware-json
CDN
<script src="https://cdn.jsdelivr.net/npm/@fatcherjs/middleware-json/dist/index.min.js"></script>
Usage
import { fatcher } from 'fatcher';
import { json } from '@fatcherjs/middleware-json';
const res = await fatcher('https://foo.bar/get', {
middlewares: [json()],
});
const streamingJson = await res.readStreamAsJson((string: string, buffer: Uint8Array) => {
console.log(string, buffer); // chunks for streaming string
}); // full result