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.
Say goodbye to EMFILE errors! Open only as many files as the operating system supports
Say goodbye to EMFILE errors! Open only as many files as the operating system supports
npm install --save safefs
// Import
var safefs = require('safefs');
// Indicate we're wanting to open a file and reserve our space in the queue
// If there is space in the pool, our callback will run right away
// If there isn't space, our callback will fire as soon as there is
safefs.openFile(function(){
// We just got some available space, lets do our stuff with the file
require('fs').writeFileSync('some-file', 'data')
// Once we're done, indicate it, so that other tasks can swim in the pool too
safefs.closeFile();
});
// If we're working with an asynchronous function, it'll look like this
safefs.openFile(function(){
require('fs').writeFile('some-file', 'data', function(err){
safefs.closeFile();
});
});
// as we only want to close file once we are completely done with it
// However, that's pretty annoying have to wrap all our calls in openFile and closeFile
// so it's a good thing that safefs provides wrappers for all the asynchronous fs methods for us
// allowing us to just do
safefs.writeFile('some-file', 'data', function(err){
// all done
});
// which will open and close the spot in the pool for us automatically, yay!
openFile(next)
closeFile()
readFile
writeFile
appendFile
mkdir
stat
readdir
unlink
rmdir
exists
existsSync
openFile
before and afterFile
after ALL file system interactionnumberOfOpenFiles
- defaults to 0
maxNumberOfOpenFiles
- defaults to process.env.NODE_MAX_OPEN_FILES
if available, otherwise sets to 100
waitingToOpenFileDelay
- defaults to 100
You can discover the history inside the History.md file
Licensed under the incredibly permissive MIT License
Copyright © 2013+ Bevry Pty Ltd
Copyright © 2011-2012 Benjamin Arthur Lupton
v2.0.1 2013 March 29
FAQs
Stop getting EMFILE errors! Open only as many files as the operating system supports.
The npm package safefs receives a total of 0 weekly downloads. As such, safefs popularity was classified as not popular.
We found that safefs demonstrated a healthy version release cadence and project activity because the last version was released less than 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.