@visulima/fs
Version:
Human friendly file system utilities for Node.js
21 lines (17 loc) • 648 B
JavaScript
;
const promises = require('node:fs/promises');
const assertValidFileOrDirectoryPath = require('./assertValidFileOrDirectoryPath-BMbgA-eI.cjs');
var __defProp = Object.defineProperty;
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
const remove = /* @__PURE__ */ __name(async (path, options = {}) => {
assertValidFileOrDirectoryPath(path);
try {
await promises.unlink(path);
} catch {
}
try {
await promises.rm(path, { force: true, maxRetries: options?.maxRetries, recursive: true, retryDelay: options?.retryDelay });
} catch {
}
}, "remove");
module.exports = remove;