# winattr

> Foolproof Windows® file attributes.

Latest version **4.0.0** (published 2026-09-01) · MIT license · 0 weekly downloads

## Install

```sh
npm install winattr
pnpm add winattr
yarn add winattr
bun add winattr
```

## Health

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

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

Warnings: low downloads.

## Facts

| | |
|---|---|
| Version | 4.0.0 |
| Published | 2026-09-01 |
| First published | 2014-08-01 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | separate (@types/winattr) |
| Module format | ESM |
| Node | >= 24 |
| Dependencies | 2 |
| Unpacked size | 32.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 25 |
| Author | Steven Vachon |
| Maintainers | stevenvachon |
| Keywords | attributes, file, fs, fs-stat, native, ntfs, windows |

## Links

- npm: https://www.npmjs.com/package/winattr
- Repository: https://github.com/stevenvachon/winattr
- Homepage: https://github.com/stevenvachon/winattr#readme
- Issues: https://github.com/stevenvachon/winattr/issues
- npm.io page: https://npm.io/package/winattr

## Dependencies (2)

- [fswin](https://npm.io/package/fswin.md) ^3.25.1108
- [is-windows](https://npm.io/package/is-windows.md) ^1.0.2

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

- 4.0.0 (latest) — 2026-09-01
- 4.0.0-rc (rc) — 2026-09-01
- 3.0.1 — 2026-08-28
- 3.0.0 — 2019-04-23
- 2.0.0 — 2016-11-02
- 1.1.0 — 2015-09-16
- 1.0.0 — 2015-06-09
- 0.2.3 — 2015-05-21
- 0.2.2 — 2014-10-24
- 0.2.1 — 2014-08-21
- 0.2.0 — 2014-08-21
- 0.1.2 — 2014-08-15
- 0.1.1 — 2014-08-12
- 0.1.0 — 2014-08-01

## README

# winattr [![NPM Version][npm-image]][npm-url] ![Build Status][ghactions-image] [![Coverage Status][codecov-image]][codecov-url]

> Foolproof Windows® file attributes.

Get and set the following on a file or directory:

- `archive`
- `hidden`
- `readonly`
- `system`

A native binding is used, offering great performance. As a contingency in case that fails, functionality will silently revert to a command line, though it is considerably slower.

> [!IMPORTANT]
>
> It may go without saying, but this library is not intended to run on anything other than Windows.

## Install

```shell
npm install winattr
```

## Usage

```js
import { getAttributes, getAttributesSync, setAttributes, setAttributesSync } from 'winattr';

await getAttributes('path/to/file.ext'); //-> {…}
getAttributesSync('path/to/file.ext'); //-> {…}

await setAttributes('path/to/folder/', { readonly: true });
setAttributesSync('path/to/folder/', { readonly: true });
```

[npm-image]: https://img.shields.io/npm/v/winattr
[npm-url]: https://npmjs.com/winattr
[ghactions-image]: https://img.shields.io/github/actions/workflow/status/stevenvachon/winattr/test.yml
[codecov-image]: https://img.shields.io/codecov/c/github/stevenvachon/winattr
[codecov-url]: https://app.codecov.io/github/stevenvachon/winattr/

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