update readme

This commit is contained in:
Randall Schmidt 2020-04-17 17:09:24 -04:00
parent 3914d35b82
commit bff8a5c175
2 changed files with 5 additions and 5 deletions

@ -2,11 +2,11 @@
node-fetch with caching to a directory on disk. node-fetch with caching to a directory on disk.
The first request will result in an HTTP request and any subsequent requests with the same arguments and body function (text, json, buffer, or textConverted) will read the response body from the cache 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.
## Usage ## Usage
Require it with a path to cache in, and then use it the same way you would use fetch. Require it with a directory path to cache in, and then use it the same way you would use fetch.
```js ```js
const fetch = require('node-fetch-cache')('./path/to/cache/dir'); const fetch = require('node-fetch-cache')('./path/to/cache/dir');
@ -18,7 +18,7 @@ fetch('http://google.com')
## API ## API
Note that this is not the full fetch API. Headers and some other things are not accessible. Note that this does not support the full fetch API. Headers and some other things are not accessible.
### async fetch(resource [, init]) ### async fetch(resource [, init])
@ -42,4 +42,4 @@ 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. 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.
(This API requires an optional dependency on [npm package encoding](https://www.npmjs.com/package/encoding), which you need to install manually. (textConverted requires an optional dependency on [npm package encoding](https://www.npmjs.com/package/encoding), which you need to install manually.

@ -1,6 +1,6 @@
{ {
"name": "node-fetch-cache", "name": "node-fetch-cache",
"version": "1.0.2", "version": "1.0.3",
"description": "node-fetch with a persistent cache.", "description": "node-fetch with a persistent cache.",
"main": "index.js", "main": "index.js",
"scripts": { "scripts": {