# stubborn-fs

> Stubborn versions of Node's fs functions that try really hard to do their job.

Latest version **2.0.0** (published 2025-10-26) · MIT license · 0 weekly downloads

## Install

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

## Health

**Score 55/100 (C)** — status: stable.

Positive: has types; esm support; no vulnerabilities.

Warnings: low downloads.

## Facts

| | |
|---|---|
| Version | 2.0.0 |
| Published | 2025-10-26 |
| First published | 2022-05-19 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 1 |
| Unpacked size | 23.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 4 |
| Maintainers | fabiospampinato |
| Keywords | fs, attempt, retry, stubborn, reliable |

## Links

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

## Dependencies (1)

- [stubborn-utils](https://npm.io/package/stubborn-utils.md) ^1.0.1

## 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

- 2.0.0 (latest) — 2025-10-26
- 1.2.5 — 2023-07-26
- 1.2.4 — 2023-02-11
- 1.2.3 — 2023-02-11
- 1.2.2 — 2023-02-11
- 1.2.1 — 2022-11-06
- 1.2.0 — 2022-05-20
- 1.1.0 — 2022-05-20
- 1.0.0 — 2022-05-19

## README

# Stubborn FS

Stubborn versions of Node's `fs` functions that try really hard to do their job.

## Install

```sh
npm install --save stubborn-fs
```

## Usage

The following functions are currently provided, if you need others please open an issue.

- `attempt` functions swallow some errors that may occur.
- `retry` functions are executed in a loop until they succeed or the timeout is reached, in which case an error is thrown.

```ts
import fs from 'stubborn-fs';

// Attempt functions (async)

fs.attempt.chmod;
fs.attempt.chown;
fs.attempt.close;
fs.attempt.fsync;
fs.attempt.mkdir;
fs.attempt.realpath;
fs.attempt.stat;
fs.attempt.unlink;

// Attempt functions (sync)

fs.attempt.chmodSync;
fs.attempt.chownSync;
fs.attempt.closeSync;
fs.attempt.existsSync;
fs.attempt.fsyncSync;
fs.attempt.mkdirSync;
fs.attempt.realpathSync;
fs.attempt.statSync;
fs.attempt.unlinkSync;

// Retry functions (async)

fs.retry.close;
fs.retry.fsync;
fs.retry.open;
fs.retry.readFile;
fs.retry.rename;
fs.retry.stat;
fs.retry.write;
fs.retry.writeFile;

// Retry functions (sync)

fs.retry.closeSync;
fs.retry.fsyncSync;
fs.retry.openSync;
fs.retry.readFileSync;
fs.retry.renameSync;
fs.retry.statSync;
fs.retry.writeSync;
fs.retry.writeFileSync;
```

## License

MIT © Fabio Spampinato

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