aboutsummaryrefslogtreecommitdiff
path: root/docs/guides/read-file/exists.md
diff options
context:
space:
mode:
Diffstat (limited to 'docs/guides/read-file/exists.md')
-rw-r--r--docs/guides/read-file/exists.md16
1 files changed, 16 insertions, 0 deletions
diff --git a/docs/guides/read-file/exists.md b/docs/guides/read-file/exists.md
new file mode 100644
index 000000000..fd6cbbf9a
--- /dev/null
+++ b/docs/guides/read-file/exists.md
@@ -0,0 +1,16 @@
+---
+name: Check if a file exists
+---
+
+The `Bun.file()` function accepts a path and returns a `BunFile` instance. Use the `.exists()` method to check if a file exists at the given path.
+
+```ts
+const path = "/path/to/package.json";
+const file = Bun.file(path);
+
+file.exists(); // boolean;
+```
+
+---
+
+Refer to [API > File I/O](/docs/api/file-io) for more information on working with `BunFile`.