# can-write-to-dir

> Returns true if the current process has permission to write to the specified directory

Latest version **2.0.0** (published 2026-03-11) · MIT license · 0 weekly downloads

## Install

```sh
npm install can-write-to-dir
pnpm add can-write-to-dir
yarn add can-write-to-dir
bun add can-write-to-dir
```

## Health

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

Positive: has types; esm support; no vulnerabilities; high maintenance score; high quality score.

Warnings: low downloads.

## Facts

| | |
|---|---|
| Version | 2.0.0 |
| Published | 2026-03-11 |
| First published | 2020-06-17 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >=22.13 |
| Dependencies | 1 |
| Unpacked size | 3.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 104 |
| Author | Zoltan Kochan <z@kochan.io> (https://www.kochan.io/) |
| Maintainers | zkochan |
| Keywords | access, permission, directory, folder |

## Links

- npm: https://www.npmjs.com/package/can-write-to-dir
- Repository: https://github.com/zkochan/packages/tree/main/can-write-to-dir
- Homepage: https://github.com/zkochan/packages/tree/main/can-write-to-dir#readme
- npm.io page: https://npm.io/package/can-write-to-dir

## Dependencies (1)

- [path-temp](https://npm.io/package/path-temp.md) ^3.0.0

## Recent versions

- 2.0.0 (latest) — 2026-03-11
- 1.1.0 (next) — 2021-02-11
- 1.1.1 — 2021-04-01
- 1.0.1 — 2021-01-13
- 1.0.0 — 2020-06-17

## README

# can-write-to-dir

> Returns true if the current process has permission to write to the specified directory

<!--@shields('npm')-->
[![npm version](https://img.shields.io/npm/v/can-write-to-dir.svg)](https://www.npmjs.com/package/can-write-to-dir)
<!--/@-->

## Installation

```sh
<npm|yarn|pnpm> add can-write-to-dir
```

## Usage

```js
const canWriteToDir = require('can-write-to-dir')

canWriteToDir.sync('C:\\')
//> false
```

## API

### `canWriteToDir.sync(dir): Boolean`

Returns `true` if `fs.writeFileSync` is able to create a file.

### `canWriteToDir(dir): Promise<Boolean>`

Returns `true` if `fs.writeFile` is able to create a file.

## License

[MIT](./LICENSE) © [Zoltan Kochan](https://www.kochan.io/)

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