windows-file-attributes
TypeScript icon, indicating that this package has built-in type declarations

1.0.0 • Public • Published

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

npm i windows-file-attributes

# or

yarn add windows-file-attributes

Some examples

import { hasAttribute, FileAttribute } from 'windows-file-attributes';

const isReadOnly = await hasAttribute('./file.txt', FileAttribute.READONLY);
console.log(isReadOnly); // boolean
import { getAttributeNames } from 'windows-file-attributes';

const names = await getAttributeNames('./file.txt');
console.log(names); // [READONLY, COMPRESSED, ARCHIVE]
import { setAttributes, FileAttribute } from 'windows-file-attributes';

await setAttributes('./file.txt', [FileAttribute.HIDDEN]);

Consult the TSDoc for each function for more info.

Readme

Keywords

none

Package Sidebar

Install

npm i windows-file-attributes

Weekly Downloads

5

Version

1.0.0

License

MIT

Unpacked Size

13.8 kB

Total Files

7

Last publish

Collaborators

  • depthbomb