UNPKG

@stryke/fs

Version:

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

31 lines (29 loc) 857 B
import { __exportAll } from "./_virtual/_rolldown/runtime.mjs"; import { existsSync, rmSync } from "node:fs"; import { rm } from "node:fs/promises"; //#region src/remove-file.ts var remove_file_exports = /* @__PURE__ */ __exportAll({ removeFile: () => removeFile, removeFileSync: () => removeFileSync }); /** * 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, remove_file_exports }; //# sourceMappingURL=remove-file.mjs.map