# idempotent-fs

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

Latest version **1.2.0** (published 2016-10-31) · MIT license · 0 weekly downloads

## Install

```sh
npm install idempotent-fs
pnpm add idempotent-fs
yarn add idempotent-fs
bun add idempotent-fs
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.2.0 |
| Published | 2016-10-31 |
| First published | 2016-09-27 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=4 |
| Dependencies | 3 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 2 |
| Author | Ron Waldon |
| Maintainers | jokeyrhyme |
| Keywords | fs, idempotent, unlink |

## Links

- npm: https://www.npmjs.com/package/idempotent-fs
- Repository: https://github.com/jokeyrhyme/idempotent-fs.js
- Homepage: https://github.com/jokeyrhyme/idempotent-fs.js#readme
- Issues: https://github.com/jokeyrhyme/idempotent-fs.js/issues
- npm.io page: https://npm.io/package/idempotent-fs

## Dependencies (3)

- [pify](https://npm.io/package/pify.md) ^2.3.0
- [mkdirp](https://npm.io/package/mkdirp.md) ^0.5.1
- [graceful-fs](https://npm.io/package/graceful-fs.md) *

## Alternatives

- [unionfs](https://npm.io/package/unionfs.md) — 2.2M weekly downloads
- [path-starts-with](https://npm.io/package/path-starts-with.md) — 35.9K weekly downloads
- [redzip](https://npm.io/package/redzip.md) — 1.2K weekly downloads
- [vscode-anymatch](https://npm.io/package/vscode-anymatch.md) — 848 weekly downloads
- [@ledgerhq/coin-filecoin](https://npm.io/package/@ledgerhq/coin-filecoin.md) — 793 weekly downloads

## Recent versions

- 1.2.0 (latest) — 2016-10-31
- 1.1.0 — 2016-09-27
- 1.0.0 — 2016-09-27

## README

# idempotent-fs.js [![npm](https://img.shields.io/npm/v/idempotent-fs.svg?maxAge=2592000)](https://www.npmjs.com/package/idempotent-fs) [![AppVeyor Status](https://ci.appveyor.com/api/projects/status/45ddby01g9niu9w8?svg=true&branch=master)](https://ci.appveyor.com/project/jokeyrhyme/idempotent-fs-js) [![Travis CI Status](https://travis-ci.org/jokeyrhyme/idempotent-fs.js.svg?branch=master)](https://travis-ci.org/jokeyrhyme/idempotent-fs.js)

`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](http://restcookbook.com/HTTP%20Methods/idempotency/).

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](https://github.com/sindresorhus/pify),
you can use either `Promise`-style or traditional callback-style.

Internally, we use [graceful-fs](https://github.com/isaacs/node-graceful-fs) instead of using the built-in "fs" module directly.


## Usage


### `mkdir()` and `mkdirSync()`

See the [upstream `mkdir()` and `mkdirSync`](https://nodejs.org/dist/latest-v6.x/docs/api/fs.html#fs_fs_mkdir_path_mode_callback) "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](https://github.com/substack/node-mkdirp)


### `rmdir()` and `rmdirSync()`

See the [upstream `rmdir()` and `rmdirSync`](https://nodejs.org/dist/latest-v6.x/docs/api/fs.html#fs_fs_rmdir_path_callback) "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!


### `unlink()` and `unlinkSync()`

See the [upstream `unlink()` and `unlinkSync`](https://nodejs.org/dist/latest-v6.x/docs/api/fs.html#fs_fs_unlink_path_callback) "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

-   [ ] [`chmod()`, `fchmod()`, `lchmod()`](https://nodejs.org/dist/latest-v6.x/docs/api/fs.html#fs_fs_chmod_path_mode_callback) ??

-   [ ] [`chown()`, `fchown()`, `lchown()`](https://nodejs.org/dist/latest-v6.x/docs/api/fs.html#fs_fs_chown_path_uid_gid_callback) ??

-   [ ] [`link()`, `symlink()`](https://nodejs.org/dist/latest-v6.x/docs/api/fs.html#fs_fs_link_srcpath_dstpath_callback)

-   [ ] [`mkdir()`](https://nodejs.org/dist/latest-v6.x/docs/api/fs.html#fs_fs_mkdir_path_mode_callback) should also test provided mode (if any)

---
_Source: https://npm.io/package/idempotent-fs · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
