winattr
v4.0.0
Published
Foolproof Windows® file attributes.
Maintainers
Readme
winattr

Foolproof Windows® file attributes.
Get and set the following on a file or directory:
archivehiddenreadonlysystem
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
npm install winattrUsage
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 });