fix: change Mb to MB

This commit is contained in:
Antoni Kepinski 2020-05-11 12:21:57 +02:00
parent 73b7a08974
commit 0936a9af0a
No known key found for this signature in database
GPG Key ID: C15767C6F117A9B6
1 changed files with 44 additions and 41 deletions

View File

@ -27,50 +27,50 @@
- [Loading and configuring the module](#loading-and-configuring-the-module) - [Loading and configuring the module](#loading-and-configuring-the-module)
- [Upgrading](#upgrading) - [Upgrading](#upgrading)
- [Common Usage](#common-usage) - [Common Usage](#common-usage)
- [Plain text or HTML](#plain-text-or-html) - [Plain text or HTML](#plain-text-or-html)
- [JSON](#json) - [JSON](#json)
- [Simple Post](#simple-post) - [Simple Post](#simple-post)
- [Post with JSON](#post-with-json) - [Post with JSON](#post-with-json)
- [Post with form parameters](#post-with-form-parameters) - [Post with form parameters](#post-with-form-parameters)
- [Handling exceptions](#handling-exceptions) - [Handling exceptions](#handling-exceptions)
- [Handling client and server errors](#handling-client-and-server-errors) - [Handling client and server errors](#handling-client-and-server-errors)
- [Handling cookies](#handling-cookies) - [Handling cookies](#handling-cookies)
- [Advanced Usage](#advanced-usage) - [Advanced Usage](#advanced-usage)
- [Streams](#streams) - [Streams](#streams)
- [Buffer](#buffer) - [Buffer](#buffer)
- [Accessing Headers and other Meta data](#accessing-headers-and-other-meta-data) - [Accessing Headers and other Meta data](#accessing-headers-and-other-meta-data)
- [Extract Set-Cookie Header](#extract-set-cookie-header) - [Extract Set-Cookie Header](#extract-set-cookie-header)
- [Post data using a file stream](#post-data-using-a-file-stream) - [Post data using a file stream](#post-data-using-a-file-stream)
- [Post with form-data (detect multipart)](#post-with-form-data-detect-multipart) - [Post with form-data (detect multipart)](#post-with-form-data-detect-multipart)
- [Request cancellation with AbortSignal](#request-cancellation-with-abortsignal) - [Request cancellation with AbortSignal](#request-cancellation-with-abortsignal)
- [API](#api) - [API](#api)
- [fetch(url[, options])](#fetchurl-options) - [fetch(url[, options])](#fetchurl-options)
- [Options](#options) - [Options](#options)
- [Default Headers](#default-headers) - [Default Headers](#default-headers)
- [Custom Agent](#custom-agent) - [Custom Agent](#custom-agent)
- [Custom highWaterMark](#custom-highwatermark) - [Custom highWaterMark](#custom-highwatermark)
- [Class: Request](#class-request) - [Class: Request](#class-request)
- [new Request(input[, options])](#new-requestinput-options) - [new Request(input[, options])](#new-requestinput-options)
- [Class: Response](#class-response) - [Class: Response](#class-response)
- [new Response([body[, options]])](#new-responsebody-options) - [new Response([body[, options]])](#new-responsebody-options)
- [response.ok](#responseok) - [response.ok](#responseok)
- [response.redirected](#responseredirected) - [response.redirected](#responseredirected)
- [Class: Headers](#class-headers) - [Class: Headers](#class-headers)
- [new Headers([init])](#new-headersinit) - [new Headers([init])](#new-headersinit)
- [Interface: Body](#interface-body) - [Interface: Body](#interface-body)
- [body.body](#bodybody) - [body.body](#bodybody)
- [body.bodyUsed](#bodybodyused) - [body.bodyUsed](#bodybodyused)
- [body.arrayBuffer()](#bodyarraybuffer) - [body.arrayBuffer()](#bodyarraybuffer)
- [body.blob()](#bodyblob) - [body.blob()](#bodyblob)
- [body.json()](#bodyjson) - [body.json()](#bodyjson)
- [body.text()](#bodytext) - [body.text()](#bodytext)
- [body.buffer()](#bodybuffer) - [body.buffer()](#bodybuffer)
- [Class: FetchError](#class-fetcherror) - [Class: FetchError](#class-fetcherror)
- [Class: AbortError](#class-aborterror) - [Class: AbortError](#class-aborterror)
- [TypeScript](#typescript) - [TypeScript](#typescript)
- [Acknowledgement](#acknowledgement) - [Acknowledgement](#acknowledgement)
- [Team](#team) - [Team](#team)
- [Former](#former) - [Former](#former)
- [License](#license) - [License](#license)
<!-- /TOC --> <!-- /TOC -->
@ -491,7 +491,7 @@ const options = {
#### Custom highWaterMark #### Custom highWaterMark
Stream on Node.js have a smaller internal buffer size (16Kb, aka `highWaterMark`) from client-side browsers (>1Mb, not consistent across browsers). Because of that, when you are writing an isomorphic app and using `res.clone()`, it will hang with large response in Node. Stream on Node.js have a smaller internal buffer size (16Kb, aka `highWaterMark`) from client-side browsers (>1MB, not consistent across browsers). Because of that, when you are writing an isomorphic app and using `res.clone()`, it will hang with large response in Node.
The recommended way to fix this problem is to resolve cloned response in parallel: The recommended way to fix this problem is to resolve cloned response in parallel:
@ -513,7 +513,10 @@ If for some reason you don't like the solution above, since `3.x` you are able t
```js ```js
const fetch = require('node-fetch'); const fetch = require('node-fetch');
fetch('https://example.com', {highWaterMark: 10}).then(res => res.clone().buffer()); fetch('https://example.com', {
// About 1MB
highWaterMark: 1024 * 1024
}).then(res => res.clone().buffer());
``` ```
<a id="class-request"></a> <a id="class-request"></a>