Socket
Socket
Sign inDemoInstall

@akryum/winattr

Package Overview
Dependencies
1
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

@akryum/winattr


Version published
Weekly downloads
65K
decreased by-17.4%
Maintainers
1
Install size
4.79 MB
Created
Weekly downloads
 

Changelog

Source

v3.0.0

Fixed:

  • Folder support on non-english OS

New:

  • get and set return a Promise if no callback is provided.

Previous versions

  • 2.0.0 removed support for Node.js v0.10 and v0.12
  • 1.1.0 added binding support to Node.js v4
  • 1.0.0
    • added getSync(),setSync()
    • removed useExec(),useNative()
    • uses binding by default, with auto-fallback to shell
  • 0.2.3 specify which script engine to use in useExec() "mode"
  • 0.2.2 switched from fswin.find() to fswin.getAttributes() now that it's available, tested non-existent files
  • 0.2.1 nearly pointless fix
  • 0.2.0 added fswin,useExec(),useNative()
  • 0.1.2 tested on Windows
  • 0.1.1 package.json optimization
  • 0.1.0 initial release

Readme

Source

winattr NPM Version Linux Build Windows Build Dependency Status

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 >= 4 is required. To install, type this at the command line:

npm install @akryum/winattr

Or:

yarn add @akryum/winattr

Usage

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", function(err, attrs) {
	if (err == null) console.log(attrs);
});

If you omit the callback, a Promise will be return instead.

getSync(path)

path - Path to file or directory

Returns an Object or throws an error if the file or dir cannot be found/accessed.

var 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}, function(err) {
	if (err == null) console.log("success");
});

If you omit the callback, a Promise will be return instead.

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

Keywords

FAQs

Last updated on 18 Jun 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc