make-fetch-happen
's direct dependencies. Data on all dependencies, including transitive ones, is available via CSV download.Name | Version | Size | License | Type | Vulnerabilities |
---|---|---|---|---|---|
agentkeepalive | 4.5.0 | 12.86 kB | MIT | prod | |
cacache | 15.3.0 | 21.46 kB | ISC | prod | 1 3 |
http-cache-semantics | 4.1.1 | 10.56 kB | BSD-2-Clause | prod | |
http-proxy-agent | 4.0.1 | 5.7 kB | MIT | prod | |
https-proxy-agent | 5.0.1 | 8.21 kB | MIT | prod | |
is-lambda | 1.0.1 | 1.8 kB | MIT | prod | |
lru-cache | 6.0.0 | 5.65 kB | ISC | prod | |
minipass-collect | 1.0.2 | 2.01 kB | ISC | prod | 1 |
minipass-fetch | 1.4.1 | 12.18 kB | MIT | prod | |
minipass-flush | 1.0.5 | 1.93 kB | ISC | prod | |
minipass-pipeline | 1.2.4 | 2.93 kB | ISC | prod | 1 |
minipass | 3.3.6 | 14.98 kB | ISC | prod | |
negotiator | 0.6.3 | 6.25 kB | MIT | prod | |
promise-retry | 2.0.1 | 4 kB | MIT | prod | |
socks-proxy-agent | 6.2.1 | 7.12 kB | MIT | prod | |
ssri | 8.0.1 | 13.76 kB | ISC | prod |
The make-fetch-happen
is an advanced Node.js library that enhances the capabilities of the minipass-fetch
by providing additional features that minipass-fetch
does not inherently include. Some of these additional features include HTTP cache support, request pooling, retries, and advanced proxy support, among others. Boosted by automated HTTP-semantics-aware request retries and cache-fallback automatic offline mode, this library is designed to supercharge the fetching of resources in your Node.js application.
To use make-fetch-happen, one needs to first install it using npm, as shown in the example below:
$ npm install --save make-fetch-happen
Once installed, you can include it into your JavaScript file and use its default or customized methods to fetch resources as follows:
const fetch = require('make-fetch-happen').defaults({
cachePath: './my-cache' // path where cache will be written (and read)
})
fetch('https://registry.npmjs.org/make-fetch-happen').then(res => {
return res.json() // download the body as JSON
}).then(body => {
console.log(`got ${body.name} from web`)
return fetch('https://registry.npmjs.org/make-fetch-happen', {
cache: 'no-cache' // forces a conditional request
})
}).then(res => {
console.log(res.status) // 304! cache validated!
return res.json().then(body => {
console.log(`got ${body.name} from cache`)
})
})
With make-fetch-happen
, you can control the behavior of the fetch operation by defining additional options such as the cache path, cache behavior, proxies, and more, giving you granular control over the fetch process in your app.
The make-fetch-happen
documentation is housed within the GitHub repository for this library. You can access a comprehensive guide and API reference on this npm package here. The documentation provides a detailed explanation of the installation process, usage examples, supported features, contributing guides, and various API options. Whether you're interested in the details of minipass-fetch
options or make-fetch-happen
custom options, all the information is clearly outlined within this doc, making it a valuable resource for anyone looking to utilize this library.