JSPM

idempotent-fs

1.2.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 244
  • Score
    100M100P100Q71471F
  • License MIT

fs.unlink() that won't throw if the file is missing + other outcome-aware Node.js fs functions

Package Exports

  • idempotent-fs

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (idempotent-fs) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

idempotent-fs.js npm AppVeyor Status Travis CI Status

fs.unlink() that won't throw if the file is missing + other outcome-aware Node.js "fs" functions

What is this?

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.

Usage

mkdir() and mkdirSync()

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

rmdir() and rmdirSync()

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!

Roadmap