【文件属性】:
文件名称:node-fetch-cache:具有内置响应缓存的节点获取
文件大小:63KB
文件格式:ZIP
更新时间:2021-08-03 10:57:36
JavaScript
节点获取缓存
node-fetch 缓存响应。
使用任何给定参数的第一次提取将导致 HTTP 请求,任何具有相同参数的后续提取将从缓存中读取响应。
默认情况下,响应缓存在内存中,但您也可以缓存到磁盘上的文件,或实现自己的缓存。 有关详细信息,请参阅缓存自定义部分。
用法
需要它并像使用 node-fetch 一样使用它:
import fetch from 'node-fetch-cache' ;
fetch ( 'http://google.com' )
. then ( response => response . text ( ) )
. then ( text => console . log ( text ) ) ;
下次fetch('http://google.com') ,将从缓存中返回响应。 不会发出 HTTP 请求。
应用程序接口
该模块的 fetch
【文件预览】:
node-fetch-cache-master
----commonjs()
--------wrapper.cjs(103B)
----package.json(1KB)
----.eslintrc.json(394B)
----.github()
--------workflows()
----test()
--------expected_png.png(8KB)
--------tests.js(16KB)
--------tests.cjs(525B)
----LICENSE(1KB)
----package-lock.json(155KB)
----src()
--------index.js(4KB)
--------classes()
----.npmignore(78B)
----.gitignore(2KB)
----README.md(6KB)
----.eslintignore(5B)
----.vscode()
--------launch.json(601B)