@thi.ng/file-io
Version:
Assorted file I/O utils (w/ logging support) for NodeJS/Bun
26 lines • 788 B
TypeScript
/**
* Assumes given path is to a directory. Checks if the dir exists and if not
* attempts to create it and then returns true. Otherwise returns false.
*
* @param dir
*/
export declare const ensureDir: (dir: string) => boolean;
/**
* Checks if the directory for given file `path` already exists, and if not the
* case, creates it. Returns true if the latter case.
*
* @remarks
* If `path` only contains a filename (without any directory structure), the
* function does nothing.
*
* @param path
*/
export declare const ensureDirForFile: (path: string) => boolean;
/**
* Returns true if `path` is a directory (assumes path exists, if not throws an
* error).
*
* @param path
*/
export declare const isDirectory: (path: string) => boolean;
//# sourceMappingURL=dir.d.ts.map