Security News
NVD Backlog Tops 20,000 CVEs Awaiting Analysis as NIST Prepares System Updates
NVD’s backlog surpasses 20,000 CVEs as analysis slows and NIST announces new system updates to address ongoing delays.
auto-reload
Advanced tools
For node.js to reload the module ,which was to be load by require
, automaticly.
npm install auto-reload
test/data/json.json
{ "name" : "Alan" }
test/json.js
const fs = require('fs');
const reload = require('auto-reload');
const data = reload('./data/json'); // reload after file changed
// print data every sec
setInterval(() => {
console.log(data.rand, data.list[0].name);
}, 1000);
// update data.json after startup
setTimeout(() => {
const text = `{
"rand": ${Math.random()},
"list": [{
"name": "Test"
}]
}`;
fs.writeFileSync(path.join(__dirname, './data/json.json'), text);
}, 0);
Result:
0 'Alan'
0 'Alan'
0 'Alan'
0 'Alan'
0.41179045320583496 'Test'
Realod function haven't support
test/data/code.js
module.exports = {
num: 0,
str: 'string',
obj: {
name: 'Alan',
age: 18
},
list: [1,3,5,7,9]
};
test/code.js
const reload = require('../');
const data = reload('./data/code');
// print data from module every sec
setInterval(function() {
console.log(new Date, data);
}, 1000);
// If you update the `time` in test/data/code.js
// the output will change immediately
FAQs
To clear require cache, and auto reload module
The npm package auto-reload receives a total of 10 weekly downloads. As such, auto-reload popularity was classified as not popular.
We found that auto-reload 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
NVD’s backlog surpasses 20,000 CVEs as analysis slows and NIST announces new system updates to address ongoing delays.
Security News
Research
A malicious npm package disguised as a WhatsApp client is exploiting authentication flows with a remote kill switch to exfiltrate data and destroy files.
Security News
PyPI now supports digital attestations, enhancing security and trust by allowing package maintainers to verify the authenticity of Python packages.