@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.07 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/exists.ts
var exists_exports = /* @__PURE__ */ require_runtime.__exportAll({
exists: () => exists,
existsSync: () => existsSync
});
/**
* Check if a file exists
*
* @param filePath - The file path to check
* @returns An indicator specifying if the file exists
*/
function existsSync(filePath) {
return (0, node_fs.existsSync)(filePath);
}
/**
* Check if a file exists
*
* @param filePath - The file path to check
* @returns An indicator specifying if the file exists
*/
async function exists(filePath) {
return (0, node_fs_promises.access)(filePath, node_fs_promises.constants.F_OK).then(() => true).catch(() => false);
}
//#endregion
exports.exists = exists;
exports.existsSync = existsSync;
Object.defineProperty(exports, 'exists_exports', {
enumerable: true,
get: function () {
return exists_exports;
}
});