fs.unlink()
that won't throw if the file is missing + other outcome-aware Node.js "fs" functions
We have taken inspiration from idempotent REST APIs.
The functions provided here intentionally mirror the "fs" module that Node.js provides, but will not throw errors under certain outcome-oriented conditions.
We've wrapped any asynchronous functions provided here with the wonderful pify,
you can use either Promise
-style or traditional callback-style.
Internally, we use graceful-fs instead of using the built-in "fs" module directly.
See the upstream mkdir()
and mkdirSync
"fs" functions in Node.js.
-
Changed: No "EEXIST" error. Trying to
mkdir()
a directory that already exists is not an error. Mission accomplished! -
Changed: internally uses mkdirp
See the upstream rmdir()
and rmdirSync
"fs" functions in Node.js.
- Changed: No "ENOENT" error. Trying to
rmdir()
a directory that is already gone is no longer an error. Mission accomplished!
See the upstream unlink()
and unlinkSync
"fs" functions in Node.js.
- Changed: No "ENOENT" error. Trying to
unlink()
a file that is already gone is no longer an error. Mission accomplished!
-
mkdir()
should also test provided mode (if any)