![Create React App Officially Deprecated Amid React 19 Compatibility Issues](https://cdn.sanity.io/images/cgdhsj6q/production/04fa08cf844d798abc0e1a6391c129363cc7e2ab-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Create React App Officially Deprecated Amid React 19 Compatibility Issues
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
fetch-filecache-for-crawling
Advanced tools
Implementation of a `fetch` that extends the implementation from `node-fetch` to add an HTTP cache using a local cache folder for crawling purpose.
Node.js module that exports a fetch
function that extends the implementation
of Node.js native fetch
to add an HTTP cache using a local cache folder.
The code was developed for a particular scenario with specific requirements in mind, and no attempts were made to generalize them. Publication as an npm package is mostly intended to ease reuse by a couple of specific projects.
Typically, the module is intended to be used for crawling purpose and makes the following assumptions, which do not hold true in other cases:
refresh
parameter. By default, the cache follows HTTP expiration rules but
setting the parameter to e.g. once
will make the cache behave completely
differently. The ability to tweak that behavior is the module's main added
value!Run npm install fetch-filecache-for-crawling
.
const fetch = require('fetch-filecache-for-crawling');
// URLs to crawl, some of which may be identical
let urls = [
'https://caniuse.com/data.json',
'https://caniuse.com/data.json'
]
Promise.all(urls.map(url =>
fetch(url, { logToConsole: true })
.then(response => response.json())
.then(json => console.log(Object.keys(json.data).length +
' entries in Can I Use'))
)).catch(err => console.error(err));
On top of usual fetch
options, the following optional parameters can be
passed to fetch
in the options
parameter to change default behavior:
cacheFolder
: the name of the cache folder to use. By default, the code caches all files in a folder named .cache
.resetCache
: set to true
to empty the cache folder when the application starts. Defaults to false
. Note that the cache folder will only be reset once, regardless of whether the parameter is set to true
in subsequent calls to fetch
.refresh
: the refresh strategy to use for the cache. Values can be one of:
force
: Always consider that the content in the cache has expireddefault
: Follow regular HTTP rules (that is the mode by default)once
: Fetch the URL at least once, but consider the cached entry to then be valid throughout the lifetime of the applicationnever
: Always consider that the content in the cache is validlogToConsole
: set to true
to output progress messages to the console. Defaults to false
. All messages start with the ID of the request to be able to distinguish between them.For instance, you may do:
const fetch = require('fetch-filecache-for-crawling');
fetch('https://www.w3.org/', {
resetCache: true,
cacheFolder: 'mycache',
logToConsole: true
}).then(response => {});
Configuration parameters may also be set for all requests programmatically by calling fetch.setParameter(name, value)
where name
is the name of the parameter to set and value
the value to set it to. Note parameters passed in options
take precedence).
The code is available under an MIT license.
FAQs
Implementation of a `fetch` that extends the implementation from `node-fetch` to add an HTTP cache using a local cache folder for crawling purpose.
The npm package fetch-filecache-for-crawling receives a total of 0 weekly downloads. As such, fetch-filecache-for-crawling popularity was classified as not popular.
We found that fetch-filecache-for-crawling demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.