From c46d08d76a4d1bd5a02b08a8a6f96c46c0fcc26f Mon Sep 17 00:00:00 2001 From: Randall Schmidt Date: Thu, 10 Jun 2021 12:24:43 -0400 Subject: [PATCH] update readme --- README.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/README.md b/README.md index 88560a2..48c5dea 100644 --- a/README.md +++ b/README.md @@ -20,6 +20,10 @@ fetch('http://google.com') This module aims to expose the same API as `node-fetch` does for the most common use cases, but may not support some of the less common use cases. +### const fetch = require('node-fetch-cache')('./path/to/cache/dir') + +Load the module and specify the directory to cache respones in. + ### async fetch(resource [, init]) Same arguments as [node-fetch](https://www.npmjs.com/package/node-fetch). @@ -58,6 +62,12 @@ Returns true if the request was redirected, false otherwise, same as [node-fetch Returns a **ResponseHeaders** object representing the headers of the response, same as [node-fetch](https://www.npmjs.com/package/node-fetch). +### async CachedResponse.ejectFromCache() + +Eject the response from the cache, so that the next request will perform a true HTTP request rather than returning a cached response. + +Keep in mind that this module caches **all** responses, even if they return error status codes. You might want to use this function when `!response.ok`, so that you can retry requests. + ### ResponseHeaders.entries() Returns the raw headers as an array of `[key, value]` pairs, same as [node-fetch](https://www.npmjs.com/package/node-fetch).