UNPKG

@fastly/js-compute

Version:

JavaScript SDK and CLI for building JavaScript applications on [Fastly Compute](https://www.fastly.com/products/edge-compute/serverless).

14 lines (12 loc) 293 B
import { stat } from 'node:fs/promises'; export async function isFileOrDoesNotExist(path) { try { const stats = await stat(path); return stats.isFile(); } catch (error) { if (error instanceof Error && error.code === 'ENOENT') { return true; } throw error; } }