hidefile
Version:
Hide files and directories on all platforms.
87 lines (86 loc) • 4.25 kB
TypeScript
/**
* Hide a file or directory by adding a "." prefix.
* On Windows, the hidden attribute is also set.
* @param {string} path Path to a file or directory.
* @throws {Error} When `path` cannot be accessed.
* @throws {InaccessiblePathError} When `path` cannot be accessed by the native binding on Windows.
* @throws {TypeError} When `path` is not a string.
* @throws {UnknownError} When the fallback command fails unexpectedly on Windows.
*/
export declare const hide: (path: string) => Promise<string>;
/**
* Synchronously hide a file or directory by adding a "." prefix.
* On Windows, the hidden attribute is also set.
* @param {string} path Path to a file or directory.
* @throws {Error} When `path` cannot be accessed.
* @throws {InaccessiblePathError} When `path` cannot be accessed by the native binding on Windows.
* @throws {TypeError} When `path` is not a string.
* @throws {UnknownError} When the fallback command fails unexpectedly on Windows.
*/
export declare const hideSync: (path: string) => string;
/**
* Determine whether the basename of `path` starts with a "." prefix.
* @param {string} path Path to a file or directory.
* @throws {TypeError} When `path` is not a string.
*/
export declare const isDotPrefixed: (path: string) => boolean;
/**
* Determine whether `path` is considered hidden.
* Unix: prefixed;
* Windows: prefixed _and_ attributed.
* @param {string} path Path to a file or directory.
* @throws {InaccessiblePathError} When `path` cannot be accessed by the native binding on Windows.
* @throws {TypeError} When `path` is not a string.
* @throws {UnknownError} When the fallback command fails unexpectedly on Windows.
*/
export declare const isHidden: (path: string) => Promise<boolean>;
/**
* Synchronously determine whether `path` is considered hidden.
* Unix: prefixed;
* Windows: prefixed _and_ attributed.
* @param {string} path Path to a file or directory.
* @throws {InaccessiblePathError} When `path` cannot be accessed by the native binding on Windows.
* @throws {TypeError} When `path` is not a string.
* @throws {UnknownError} When the fallback command fails unexpectedly on Windows.
*/
export declare const isHiddenSync: (path: string) => boolean;
/**
* Reveal a file or directory by removing a "." prefix.
* On Windows, the hidden attribute is also removed.
* @param {string} path Path to a file or directory.
* @throws {Error} When `path` cannot be accessed.
* @throws {InaccessiblePathError} When `path` cannot be accessed by the native binding on Windows.
* @throws {TypeError} When `path` is not a string.
* @throws {UnknownError} When the fallback command fails unexpectedly on Windows.
*/
export declare const reveal: (path: string) => Promise<string>;
/**
* Synchronously reveal a file or directory by removing a "." prefix.
* On Windows, the hidden attribute is also removed.
* @param {string} path Path to a file or directory.
* @throws {Error} When `path` cannot be accessed.
* @throws {InaccessiblePathError} When `path` cannot be accessed by the native binding on Windows.
* @throws {TypeError} When `path` is not a string.
* @throws {UnknownError} When the fallback command fails unexpectedly on Windows.
*/
export declare const revealSync: (path: string) => string;
/**
* Determine whether `path` should be treated as hidden.
* Unix: prefixed;
* Windows: prefixed _or_ attributed.
* @param {string} path Path to a file or directory.
* @throws {InaccessiblePathError} When `path` cannot be accessed by the native binding on Windows.
* @throws {TypeError} When `path` is not a string.
* @throws {UnknownError} When the fallback command fails unexpectedly on Windows.
*/
export declare const shouldBeHidden: (path: string) => Promise<boolean>;
/**
* Synchronously determine whether `path` should be treated as hidden.
* Unix: prefixed;
* Windows: prefixed _or_ attributed.
* @param {string} path Path to a file or directory.
* @throws {InaccessiblePathError} When `path` cannot be accessed by the native binding on Windows.
* @throws {TypeError} When `path` is not a string.
* @throws {UnknownError} When the fallback command fails unexpectedly on Windows.
*/
export declare const shouldBeHiddenSync: (path: string) => boolean;