hidefile
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.
Installation
Node.js >= 8
is required. To install, type this at the command line:
npm install hidefile
Methods
hide(path, callback)
path
- Path to file or directory
callback(err,newpath)
- A callback which is called upon completion
hidefile;
hideSync(path)
path
- Path to file or directory
Throws an error if the file or dir cannot be found/accessed.
const newpath = hidefile; console; //-> 'path/to/.file.ext'
isDotPrefixed(path)
path
- Path to file or directory
console; //-> trueconsole; //-> false
isHidden(path, callback)
path
- Path to file or directory
callback(result)
- A callback which is called upon completion
hidefile;
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.
const result = hidefile; console; //-> false
reveal(path, callback)
path
- Path to file or directory
callback(err,newpath)
- A callback which is called upon completion
hidefile;
revealSync(path)
path
- Path to file or directory
Throws an error if the file or dir cannot be found/accessed.
const newpath = hidefile; console; //-> '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;
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; console; //-> true