ky-universal
Advanced tools
Comparing version 0.6.0 to 0.7.0
@@ -5,4 +5,6 @@ 'use strict'; | ||
const TEN_MEGABYTES = 1000 * 1000 * 10; | ||
if (!global.fetch) { | ||
global.fetch = fetch; | ||
global.fetch = (url, options) => fetch(url, {highWaterMark: TEN_MEGABYTES, ...options}); | ||
} | ||
@@ -9,0 +11,0 @@ |
{ | ||
"name": "ky-universal", | ||
"version": "0.6.0", | ||
"version": "0.7.0", | ||
"description": "Use Ky in both Node.js and browsers", | ||
@@ -14,3 +14,3 @@ "license": "MIT", | ||
"engines": { | ||
"node": ">=10" | ||
"node": ">=10.16" | ||
}, | ||
@@ -58,3 +58,3 @@ "scripts": { | ||
"abort-controller": "^3.0.0", | ||
"node-fetch": "^2.6.0" | ||
"node-fetch": "^3.0.0-beta.6-exportfix" | ||
}, | ||
@@ -61,0 +61,0 @@ "devDependencies": { |
@@ -55,3 +55,3 @@ # ky-universal [![Build Status](https://travis-ci.com/sindresorhus/ky-universal.svg?branch=master)](https://travis-ci.com/sindresorhus/ky-universal) | ||
const result = new TextDecoder('utf-8').decode(value); | ||
// … | ||
@@ -99,2 +99,21 @@ })(); | ||
#### `clone()` hangs with a large response in Node - What should I do? | ||
Streams in Node.js have a smaller internal buffer size (16 kB, aka `highWaterMark`) than browsers (>1 MB, not consistent across browsers). When using Ky, the default `highWaterMark` is set to 10 MB, so you shouldn't encounter many issues related to that. | ||
However, you can specify a custom `highWaterMark` if needed: | ||
```js | ||
import ky from 'ky-universal'; | ||
(async () => { | ||
const response = await ky('https://example.com', { | ||
// 20 MB | ||
highWaterMark: 1000 * 1000 * 20 | ||
}); | ||
const data = await response.clone().buffer(); | ||
})(); | ||
``` | ||
## Related | ||
@@ -101,0 +120,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
6617
28
121
+ Addeddata-uri-to-buffer@4.0.1(transitive)
+ Addedfetch-blob@3.2.0(transitive)
+ Addedformdata-polyfill@4.0.10(transitive)
+ Addednode-domexception@1.0.0(transitive)
+ Addednode-fetch@3.3.2(transitive)
+ Addedweb-streams-polyfill@3.3.3(transitive)
- Removednode-fetch@2.7.0(transitive)
- Removedtr46@0.0.3(transitive)
- Removedwebidl-conversions@3.0.1(transitive)
- Removedwhatwg-url@5.0.0(transitive)