JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 63734
  • Score
    100M100P100Q153181F
  • License MIT

Hide files and directories on all platforms.

Package Exports

  • hidefile

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (hidefile) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

hidefile NPM Version Linux Build Windows Build Dependency Status

Hide files and directories on all platforms.

Unix:

  • Adds or removes a "." prefix on a file or dir

Windows:

  • Adds or removes a "." prefix on a file or dir
  • Adds or removes the "hidden" attribute on a file or dir

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.

Getting Started

Node.js >= 0.10 is required. To install, type this at the command line:

npm install hidefile --save-dev

Methods

hide(path, callback)

path - Path to file or directory
callback(err,newpath) - A callback which is called upon completion

hidefile.hide("path/to/file.ext", function(err, newpath) {
    if (err==null) console.log(newpath);  //-> "path/to/.file.ext"
});

hideSync(path)

path - Path to file or directory

Throws an error if the file or dir cannot be found/accessed.

var newpath = hidefile.hideSync("path/to/file.ext");

console.log(newpath);  //-> "path/to/.file.ext"

isDotPrefixed(path)

path - Path to file or directory

console.log( hidefile.isDotPrefixed("path/to/.file.ext") );  //-> true
console.log( hidefile.isDotPrefixed("path/to/file.ext") );   //-> false

isHidden(path, callback)

path - Path to file or directory
callback(result) - A callback which is called upon completion

hidefile.isHidden("path/to/file.ext", function(err, result) {
    if (err==null) console.log(result);  //-> false
});

Unix: result is true if prefixed.
Windows: result is true if prefixed and has "hidden" attribute, false if only prefixed.

isHiddenSync(path)

path - Path to file or directory

Throws an error if the file or dir cannot be found/accessed.

var result = hidefile.isHiddenSync("path/to/file.ext");

console.log(result);  //-> false

reveal(path, callback)

path - Path to file or directory
callback(err,newpath) - A callback which is called upon completion

hidefile.reveal("path/to/.file.ext", function(err, newpath) {
    if (err==null) console.log(newpath);  //-> "path/to/file.ext"
});

revealSync(path)

path - Path to file or directory

Throws an error if the file or dir cannot be found/accessed.

var newpath = hidefile.revealSync("path/to/.file.ext");

console.log(newpath);  //-> "path/to/file.ext"

shouldBeHidden(path, callback)

path - Path to file or directory
callback(result) - A callback which is called upon completion

if (isWindows) {
    hidefile.shouldBeHidden("path/to/.file.ext", function(err, result) {
        if (err==null) console.log(result);  //-> true
    });
}

Unix: result is true if prefixed.
Windows: result is true if prefixed or has "hidden" attribute.

shouldBeHiddenSync(path)

path - Path to file or directory

Throws an error if the file or dir cannot be found/accessed.

if (isWindows) {
    result = hidefile.shouldBeHiddenSync("path/to/.file.ext");
    
    console.log(result);  //-> true
}

Changelog

  • 1.1.0 added binding support to Node.js v4
  • 1.0.0
    • added hideSync(),isHiddenSync(),revealSync(),shouldBeHiddenSync()
    • removed useExec(),useNative()
    • uses binding by default, with auto-fallback to shell
  • 0.2.0 added useExec(),useNative()
  • 0.1.2 tested on Windows
  • 0.1.1 package.json optimization
  • 0.1.0 initial release