UNPKG

@thi.ng/file-io

Version:

Assorted file I/O utils (w/ logging support) for NodeJS/Bun

51 lines 1.46 kB
/** * Adds given path pattern and its replacement string to registered path masks. * * @remarks * By default only the `$HOME` dir will be masked (if that env var is defined). * * Also see {@link maskedPath} and {@link setPathMasks}. * * @param pattern * @param mask */ export declare const addPathMask: (pattern: string | RegExp, mask?: string) => void; /** * Overrides ALL registered path masks with those given. * * @remarks * Also see {@link maskedPath} and {@link addPathMasks}. * * @param masks */ export declare const setPathMasks: (masks: [RegExp, string][]) => [RegExp, string][]; /** * Iteratively applies all registered path masks to given `path` and returns * result. * * @remarks * This function is used by all logging functions in this package. By default * only the `$HOME` dir will be masked (if that env var is defined). * * See {@link addPathMask}, {@link setPathMasks}. * * @example * ```ts * maskedPath("/Users/asterix/foo/bar.txt"); * // "~/foo/bar.txt" * ``` * * @param path */ export declare const maskedPath: (path: string) => string; /** * Replaces `home` (default: `process.env.HOME`) sub-path with given `mask` * (default: `~`). Used by all path logging calls in this package. * * @param path * @param home * * @deprecated use {@link maskedPath} instead */ export declare const maskHomeDir: (path: string, home?: string | undefined, mask?: string) => string; //# sourceMappingURL=mask.d.ts.map