# @react-native-windows/fs

> A minimal-dependency drop-in replacement to `fs` with changes for resiliency, promises, and convenience.

Latest version **0.84.0** (published 2026-06-18) · MIT license · 0 weekly downloads

## Install

```sh
npm install @react-native-windows/fs
pnpm add @react-native-windows/fs
yarn add @react-native-windows/fs
bun add @react-native-windows/fs
```

## Health

**Score 65/100 (B)** — status: active.

Positive: has types; no vulnerabilities; recently updated; high maintenance score; popular repo.

Warnings: low downloads; no esm support; pre 1.0.

## Facts

| | |
|---|---|
| Version | 0.84.0 |
| Published | 2026-06-18 |
| First published | 2021-11-18 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 164.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 17342 |
| Maintainers | rnbot, dannyvv, microsoft1es, acoates, microsoft-oss-releases |

## Links

- npm: https://www.npmjs.com/package/@react-native-windows/fs
- Repository: https://github.com/microsoft/react-native-windows
- Homepage: https://github.com/microsoft/react-native-windows#readme
- Issues: https://github.com/microsoft/react-native-windows/issues
- npm.io page: https://npm.io/package/@react-native-windows/fs

## Dependencies (2)

- [minimatch](https://npm.io/package/minimatch.md) ^10.0.3
- [graceful-fs](https://npm.io/package/graceful-fs.md) ^4.2.8

## Recent versions

- 0.84.0 (latest) — 2026-06-18
- 0.81.2 (v0.81-stable) — 2026-08-19
- 0.85.0-preview.1 (preview) — 2026-07-22
- 0.83.1 (v0.83-stable) — 2026-06-18
- 0.82.1 (v0.82-stable) — 2026-05-26
- 0.0.0-canary.72 (canary) — 2026-04-07
- 0.80.1 (v0.80-stable) — 2025-12-20
- 0.79.1 (v0.79-stable) — 2025-10-27
- 0.78.1 (v0.78-stable) — 2025-06-10
- 0.77.1 (v0.77-stable) — 2025-02-27
- 0.76.1 (v0.76-stable) — 2025-01-24
- 0.75.2 (v0.75-stable) — 2024-11-11
- 0.74.1 (v0.74-stable) — 2024-08-19
- 0.73.1 (v0.73-stable) — 2024-04-26
- 0.72.1 (v0.72-stable) — 2023-12-08
- … 122 more at https://npm.io/package/@react-native-windows/fs/versions

## README

# @react-native-windows/fs

`@react-native-windows/fs` is a minimal-dependency drop-in replacement to `fs` with changes for
resiliency, promises, and convenience. It has several opinionated changes, targeted towards CLI
applications handling JavaScript-oriented files.

![Usage Thumbnail](./assets/logo.png)

## Async Usage (Default)

`@react-native-windows/fs` exposes a Promise-based API, mostly matching that of `fs.promises`, with
several methods added [extra methods](#Extra-Methods).

```ts
// import {promises as fs} from 'fs'
import fs from '@react-native-windows/fs';

const fileContent = await fs.readFile('foo.txt');
```

## Sync Usage

`@react-native-windows/fs` exports all `fs.*Sync` Where an async version has a graceful
implementation, and the synchronous version does not, the method is marked as deprecated.

```ts
// import fs from 'fs'
import fs from '@react-native-windows/fs';

const fileContent = fs.readFileSync('foo.txt');
```

## Extra Methods

### `exists`
NodeJS deprecated `fs.exists`, and removed `fs.promises.exists`. The recommendation is to instead
acquire a lock to the file via `fs.open` for the duration of file-use. One-shot existence checks are
still useful, and because `fs.existsSync`is not deprecated, more likely means usage of blocking
synchronous APIs.

```ts
import fs from '@react-native-windows/fs';

const fooExists = await fs.exists('foo.txt');
```

### `readJsonFile` and `readJsonFileSync`

`@react-native-windows/fs` provides convenience methods to handle JSON files. The following methods
are added:

| Method | Return type |
|-|-|
| `readJsonFile<T>` | `Promise<T>` or `Promise<Record<string, unknown>>` |
| `readJsonFileSync<T>` | `T` or `Record<string, unknown>` |

```ts
import fs from '@react-native-windows/fs';

// foo is type: Record<string, unknown> by default
const foo = await fs.readJsonFile('foo.json');

// foo is type: FooProps
type FooProps = { name: string, version: string };
const foo = await fs.readJsonFile<FooProps>('foo.json');
```

## Resiliency

`@react-native-windows/fs` uses [`graceful-fs`](https://github.com/isaacs/node-graceful-fs) to
gracefully handle transient filesystem conditions, at the cost of extra latency. This includes
transient `EPERM`, `EACCESS`, `EMFILE`, `ENFILE`. This can be important when handling files that a
subject to antivirus, which may temporarily lock mutation of files on Windows.

## eslint
We reccomend adding the following rules to your eslint config if you would like to use
`@react-native-windows/fs` everywhere:
```js
module.exports = {
  rules: {
    'no-restricted-imports': [
      'error', {
        name: 'fs',
        message: 'Please use `@react-native-windows/fs` instead of `fs`'
      }
    ],
  }
}
```

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