@visulima/fs
Version:
Human friendly file system utilities for Node.js
16 lines (15 loc) • 591 B
TypeScript
/**
* Ensures that the file exists.
* If the file that is requested to be created is in directories that do not exist,
* these directories are created. If the file already exists, it is NOT MODIFIED.
* @param filePath The path to the file to ensure exists.
* @example
* ```javascript
* import { ensureFileSync } from "@visulima/fs";
*
* ensureFileSync("/tmp/foo/bar/baz.txt");
* // Creates the file /tmp/foo/bar/baz.txt and any missing parent directories if they don't exist
* ```
*/
declare const ensureFileSync: (filePath: URL | string) => void;
export default ensureFileSync;