Stop getting EMFILE errors! Open only as many files as the operating system supports.
npm install --save safefs
This package is published with the following editions:
safefs/index.jswhich uses Editions to automatically select the correct edition for the consumers environment
safefs/source/index.jsis Source + ESNext + Require
safefs/es2015/index.jsis Babel Compiled + ES2015 + Require
Older environments may need Babel's Polyfill or something similar.
var safefs =
On-top of graceful-fs, SafeFS also adds additional wrapping on the following methods:
writeFile(path, data, options?, next)- ensure the full path exists before writing to it
appendFile(path, data, options?, next)- ensure the full path exists before writing to it
mkdir(path, mode?, next)- mode defaults to
0o777 & (~process.umask())
unlink(path, next)- checks if the file exists before removing it
SafeFS also define these additional methods:
ensurePath(path, options, next)- ensure the full path exists, equivalent to unix's
mdir -p path
getParentPathSync(path)- returns the parent directory of the path
These amazing people are maintaining this project:
No sponsors yet! Will you be the first?
These amazing people have contributed code to this project:
Unless stated otherwise all works are:
and licensed under: