https://github.com/depthbomb/windows-file-attributes
A pure TypeScript library for setting and reading file attributes on Windows
https://github.com/depthbomb/windows-file-attributes
Last synced: about 1 year ago
JSON representation
A pure TypeScript library for setting and reading file attributes on Windows
- Host: GitHub
- URL: https://github.com/depthbomb/windows-file-attributes
- Owner: depthbomb
- License: mit
- Created: 2025-04-16T04:43:25.000Z (about 1 year ago)
- Default Branch: master
- Last Pushed: 2025-05-01T06:02:25.000Z (about 1 year ago)
- Last Synced: 2025-05-19T20:19:27.332Z (about 1 year ago)
- Language: TypeScript
- Size: 1.95 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# windows-file-attributes
A pure TypeScript library for setting and reading file attributes on Windows.
## Features
- Reading attributes of a file
- Adding attributes to a file
- Checking if a file has one or more attributes
- No dependencies
- Written entirely in TypeScript
- Great with Electron!
## Installation
```sh
npm i windows-file-attributes
# or
yarn add windows-file-attributes
```
## Some examples
```ts
import { hasAttribute, FileAttribute } from 'windows-file-attributes';
const isReadOnly = await hasAttribute('./file.txt', FileAttribute.READONLY);
console.log(isReadOnly); // boolean
```
```ts
import { getAttributeNames } from 'windows-file-attributes';
const names = await getAttributeNames('./file.txt');
console.log(names); // [READONLY, COMPRESSED, ARCHIVE]
```
```ts
import { setAttributes, FileAttribute } from 'windows-file-attributes';
await setAttributes('./file.txt', [FileAttribute.HIDDEN]);
```
Consult the TSDoc for each function for more info.