@stryke/fs
Version:
A package containing various file system utilities that expand the functionality of NodeJs's built-in `fs` module.
28 lines (26 loc) • 841 B
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
/**
* 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;