From 0f5f1edb223834071952e2b866f15ea68e9240e6 Mon Sep 17 00:00:00 2001 From: Randall Schmidt Date: Sun, 11 Jul 2021 09:11:26 -0400 Subject: [PATCH] switch to ESM examples --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 863b224..14083e9 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ By default responses are cached in memory, but you can also cache to files on di Require it and use it the same way you would use node-fetch: ```js -const fetch = require('node-fetch-cache'); +import fetch from 'node-fetch-cache'; fetch('http://google.com') .then(response => response.text()) @@ -33,7 +33,7 @@ This function can be used to eject the response from the cache, so that the next This module caches ALL responses, even those with 4xx and 5xx response statuses. You can use this function to uncache such responses if desired. For example: ```js -const fetch = require('node-fetch-cache'); +import fetch from 'node-fetch-cache'; fetch('http://google.com') .then(async response => { @@ -63,7 +63,7 @@ This is the default cache delegate. It caches responses in-process in a POJO. Usage: ```js -const { fetchBuilder, MemoryCache } = require('node-fetch-cache'); +import { fetchBuilder, MemoryCache } from'node-fetch-cache'; const fetch = fetchBuilder.withCache(new MemoryCache(options)); ``` @@ -84,7 +84,7 @@ Cache to a directory on disk. This allows the cache to survive the process exiti Usage: ```js -const { fetchBuilder, FileSystemCache } = require('node-fetch-cache'); +import { fetchBuilder, FileSystemCache } from 'node-fetch-cache'; const fetch = fetchBuilder.withCache(new FileSystemCache(options)); ```