node-fetch with caching to a directory on disk.
The first usage with any given arguments will result in an HTTP request and any subsequent usage with the same arguments and body function (text, json, buffer, or textConverted) will read the response body from the cache on disk.
Require it with a directory path to cache in, and then use it the same way you would use fetch.
const fetch = './path/to/cache/dir';;
Note that this does not support the full fetch API. Headers and some other things are not accessible.
async fetch(resource [, init])
Same arguments as browser fetch.
Returns a CachedResponse.
Returns the body as a string.
Returns the body as a Buffer.
Identical to CachedResponse.text(), except instead of always converting to UTF-8, encoding sniffing will be performed and text converted to UTF-8, if possible.
(textConverted requires an optional dependency on npm package encoding, which you need to install manually.