@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) • 860 B
JavaScript
import { __exportAll } from "./_virtual/_rolldown/runtime.mjs";
import { existsSync as existsSync$1 } from "node:fs";
import { access, constants as constants$1 } from "node:fs/promises";
//#region src/exists.ts
var exists_exports = /* @__PURE__ */ __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 existsSync$1(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 access(filePath, constants$1.F_OK).then(() => true).catch(() => false);
}
//#endregion
export { exists, existsSync, exists_exports };
//# sourceMappingURL=exists.mjs.map