npm.io
4.0.0 • Published 1 week ago

winattr

Licence
MIT
Version
4.0.0
Deps
2
Size
32 kB
Vulns
0
Weekly
0
Stars
25

winattr NPM Version Build Status Coverage Status

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.

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

Install

npm install winattr

Usage

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 });

Keywords