winattr
Foolproof Windows® file attributes for Node.js
Get and set:
archive
hidden
readonly
system
… on files and/or directories.
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.
Installation
It may go without saying, but this library is not intended to run on anything other than Windows.
Node.js >= 8
is required. To install, type this at the command line:
npm install winattr
Methods
get(path, callback)
path
- Path to file or directory
callback(err,attrs)
- A callback which is called upon completion
winattr;
getSync(path)
path
- Path to file or directory
Returns an Object
or throws an error if the file or dir cannot be found/accessed.
const attrs = winattr; console;
set(path, attrs, callback)
path
- Path to file or directory
attrs
- An object containing attributes to change
callback(err)
- A callback which is called upon completion
winattr;
setSync(path, attrs)
path
- Path to file or directory
attrs
- An object containing attributes to change
Throws an error if the file or dir cannot be found/accessed.
winattr;