@stryke/fs
Version:
A package containing various file system utilities that expand the functionality of NodeJs's built-in `fs` module.
38 lines (36 loc) • 1.12 kB
JavaScript
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
const require_runtime = require('./_virtual/_rolldown/runtime.cjs');
let node_fs = require("node:fs");
let node_fs_promises = require("node:fs/promises");
//#region src/remove-file.ts
var remove_file_exports = /* @__PURE__ */ require_runtime.__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 || !(0, node_fs.existsSync)(filePath)) return;
(0, node_fs.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 || !(0, node_fs.existsSync)(filePath)) return;
return (0, node_fs_promises.rm)(filePath);
};
//#endregion
exports.removeFile = removeFile;
exports.removeFileSync = removeFileSync;
Object.defineProperty(exports, 'remove_file_exports', {
enumerable: true,
get: function () {
return remove_file_exports;
}
});