winattr
Foolproof Windows® file attributes.
Last updated 7 years ago by stevenvachon .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install winattr 
SYNC missed versions from official npm registry.

winattr NPM Version Linux Build Windows Build Coverage Status Dependency Monitor

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.get('path/to/file.ext', (err, attrs) => {
  if (err == null) {
    console.log(attrs);
  }
});

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.getSync('path/to/file.ext');

console.log(attrs);

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.set('path/to/folder/', {readonly:true}, err => {
  if (err == null) {
    console.log('success');
  }
});

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.setSync('path/to/folder/', {readonly:true});

Current Tags

  • 3.0.0                                ...           latest (7 years ago)

11 Versions

  • 3.0.0                                ...           7 years ago
  • 2.0.0                                ...           9 years ago
  • 1.1.0                                ...           11 years ago
  • 1.0.0                                ...           11 years ago
  • 0.2.3                                ...           11 years ago
  • 0.2.2                                ...           11 years ago
  • 0.2.1                                ...           12 years ago
  • 0.2.0                                ...           12 years ago
  • 0.1.2                                ...           12 years ago
  • 0.1.1                                ...           12 years ago
  • 0.1.0                                ...           12 years ago
Maintainers (1)
Downloads
Today 0
This Week 3
This Month 8
Last Day 3
Last Week 6
Last Month 1
Dependencies (1)
Dev Dependencies (4)
Dependents (1)

Copyright 2013 - present © cnpmjs.org | Home |