Bun.file() 函数接受一个路径并返回一个 BunFile 实例。使用 .exists() 方法检查给定路径是否存在文件。
ts
const path = "/path/to/package.json";
const file = Bun.file(path);
await file.exists(); // boolean;请参阅 API > 文件 I/O,了解使用 BunFile 的更多信息。