27
27
- [ Loading and configuring the module] ( #loading-and-configuring-the-module )
28
28
- [ Upgrading] ( #upgrading )
29
29
- [ Common Usage] ( #common-usage )
30
- - [ Plain text or HTML] ( #plain-text-or-html )
31
- - [ JSON] ( #json )
32
- - [ Simple Post] ( #simple-post )
33
- - [ Post with JSON] ( #post-with-json )
34
- - [ Post with form parameters] ( #post-with-form-parameters )
35
- - [ Handling exceptions] ( #handling-exceptions )
36
- - [ Handling client and server errors] ( #handling-client-and-server-errors )
37
- - [ Handling cookies] ( #handling-cookies )
30
+ - [Plain text or HTML](#plain-text-or-html)
31
+ - [JSON](#json)
32
+ - [Simple Post](#simple-post)
33
+ - [Post with JSON](#post-with-json)
34
+ - [Post with form parameters](#post-with-form-parameters)
35
+ - [Handling exceptions](#handling-exceptions)
36
+ - [Handling client and server errors](#handling-client-and-server-errors)
37
+ - [Handling cookies](#handling-cookies)
38
38
- [ Advanced Usage] ( #advanced-usage )
39
- - [ Streams] ( #streams )
40
- - [ Buffer] ( #buffer )
41
- - [ Accessing Headers and other Meta data] ( #accessing-headers-and-other-meta-data )
42
- - [ Extract Set-Cookie Header] ( #extract-set-cookie-header )
43
- - [ Post data using a file stream] ( #post-data-using-a-file-stream )
44
- - [ Post with form-data (detect multipart)] ( #post-with-form-data-detect-multipart )
45
- - [ Request cancellation with AbortSignal] ( #request-cancellation-with-abortsignal )
39
+ - [Streams](#streams)
40
+ - [Buffer](#buffer)
41
+ - [Accessing Headers and other Meta data](#accessing-headers-and-other-meta-data)
42
+ - [Extract Set-Cookie Header](#extract-set-cookie-header)
43
+ - [Post data using a file stream](#post-data-using-a-file-stream)
44
+ - [Post with form-data (detect multipart)](#post-with-form-data-detect-multipart)
45
+ - [Request cancellation with AbortSignal](#request-cancellation-with-abortsignal)
46
46
- [ API] ( #api )
47
- - [ fetch(url[ , options] )] ( #fetchurl-options )
48
- - [ Options] ( #options )
49
- - [ Default Headers] ( #default-headers )
50
- - [ Custom Agent] ( #custom-agent )
51
- - [ Custom highWaterMark] ( #custom-highwatermark )
52
- - [ Class: Request] ( #class-request )
53
- - [ new Request(input[ , options] )] ( #new-requestinput-options )
54
- - [ Class: Response] ( #class-response )
55
- - [ new Response([ body[ , options]] )] ( #new-responsebody-options )
56
- - [ response.ok] ( #responseok )
57
- - [ response.redirected] ( #responseredirected )
58
- - [ Class: Headers] ( #class-headers )
59
- - [ new Headers([ init] )] ( #new-headersinit )
60
- - [ Interface: Body] ( #interface-body )
61
- - [ body.body] ( #bodybody )
62
- - [ body.bodyUsed] ( #bodybodyused )
63
- - [ body.arrayBuffer()] ( #bodyarraybuffer )
64
- - [ body.blob()] ( #bodyblob )
65
- - [ body.json()] ( #bodyjson )
66
- - [ body.text()] ( #bodytext )
67
- - [ body.buffer()] ( #bodybuffer )
68
- - [ Class: FetchError] ( #class-fetcherror )
69
- - [ Class: AbortError] ( #class-aborterror )
47
+ - [fetch(url[, options])](#fetchurl-options)
48
+ - [Options](#options)
49
+ - [Default Headers](#default-headers)
50
+ - [Custom Agent](#custom-agent)
51
+ - [Custom highWaterMark](#custom-highwatermark)
52
+ - [Class: Request](#class-request)
53
+ - [new Request(input[, options])](#new-requestinput-options)
54
+ - [Class: Response](#class-response)
55
+ - [new Response([body[, options]])](#new-responsebody-options)
56
+ - [response.ok](#responseok)
57
+ - [response.redirected](#responseredirected)
58
+ - [Class: Headers](#class-headers)
59
+ - [new Headers([init])](#new-headersinit)
60
+ - [Interface: Body](#interface-body)
61
+ - [body.body](#bodybody)
62
+ - [body.bodyUsed](#bodybodyused)
63
+ - [body.arrayBuffer()](#bodyarraybuffer)
64
+ - [body.blob()](#bodyblob)
65
+ - [body.json()](#bodyjson)
66
+ - [body.text()](#bodytext)
67
+ - [body.buffer()](#bodybuffer)
68
+ - [Class: FetchError](#class-fetcherror)
69
+ - [Class: AbortError](#class-aborterror)
70
70
- [ TypeScript] ( #typescript )
71
71
- [ Acknowledgement] ( #acknowledgement )
72
72
- [ Team] ( #team )
73
- - [ Former] ( #former )
73
+ - [Former](#former)
74
74
- [ License] ( #license )
75
75
76
76
<!-- /TOC -->
@@ -491,7 +491,7 @@ const options = {
491
491
492
492
#### Custom highWaterMark
493
493
494
- 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.
494
+ 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.
495
495
496
496
The recommended way to fix this problem is to resolve cloned response in parallel:
497
497
@@ -513,7 +513,10 @@ If for some reason you don't like the solution above, since `3.x` you are able t
513
513
``` js
514
514
const fetch = require (' node-fetch' );
515
515
516
- fetch (' https://example.com' , {highWaterMark: 10 }).then (res => res .clone ().buffer ());
516
+ fetch (' https://example.com' , {
517
+ // About 1MB
518
+ highWaterMark: 1024 * 1024
519
+ }).then (res => res .clone ().buffer ());
517
520
```
518
521
519
522
<a id =" class-request " ></a >
0 commit comments