heartbeat-monitor/node_modules/next/dist/esm/lib/file-exists.js
Matt Bruce bed1169443 Initial commit: Heartbeat Monitor dashboard
- Full-featured monitoring dashboard for local web apps
- Real-time status tracking with uptime percentages
- Visual sparklines for status history
- Add/Edit/Delete apps dynamically
- Categories and color coding
- Auto-refresh every 30 seconds
- API endpoints for apps and status management
2026-02-18 11:16:01 -06:00

26 lines
814 B
JavaScript

import { existsSync, promises } from 'fs';
import isError from './is-error';
export var FileType = /*#__PURE__*/ function(FileType) {
FileType["File"] = "file";
FileType["Directory"] = "directory";
return FileType;
}({});
export async function fileExists(fileName, type) {
try {
if (type === "file") {
const stats = await promises.stat(fileName);
return stats.isFile();
} else if (type === "directory") {
const stats = await promises.stat(fileName);
return stats.isDirectory();
}
return existsSync(fileName);
} catch (err) {
if (isError(err) && (err.code === 'ENOENT' || err.code === 'ENAMETOOLONG')) {
return false;
}
throw err;
}
}
//# sourceMappingURL=file-exists.js.map