UNPKG

@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) 816 B
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 /** * 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;