UNPKG

@stryke/fs

Version:

A package containing various file system utilities that expand the functionality of NodeJs's built-in `fs` module.

26 lines (24 loc) 643 B
import { existsSync, rmSync } from "node:fs"; import { rm } from "node:fs/promises"; //#region src/remove-file.ts /** * Remove the given content to the given file path * * @param filePath - The file path to remove to */ const removeFileSync = (filePath) => { if (!filePath || !existsSync(filePath)) return; rmSync(filePath); }; /** * Remove the given content to the given file path * * @param filePath - The file path to read to */ const removeFile = async (filePath) => { if (!filePath || !existsSync(filePath)) return; return rm(filePath); }; //#endregion export { removeFile, removeFileSync }; //# sourceMappingURL=remove-file.mjs.map