From edeb75a84acc4e9b9d708bb7a99b8d0fa6eb312e Mon Sep 17 00:00:00 2001 From: David Ferguson Date: Thu, 11 Apr 2024 15:24:49 -0500 Subject: [PATCH] Reference .exists() in File-IO Docs (#9957) * add mention of .exists() * show that the exists method returns a promise in the docs * remove unnecessary white space * update type ref to show that exists returns a promise --- docs/api/file-io.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/api/file-io.md b/docs/api/file-io.md index 314e8b7332..f1f12f5eb4 100644 --- a/docs/api/file-io.md +++ b/docs/api/file-io.md @@ -43,6 +43,7 @@ A `BunFile` can point to a location on disk where a file does not exist. const notreal = Bun.file("notreal.txt"); notreal.size; // 0 notreal.type; // "text/plain;charset=utf-8" +const exists = await notreal.exists(); // false ``` The default MIME type is `text/plain;charset=utf-8`, but it can be overridden by passing a second argument to `Bun.file`. @@ -340,6 +341,7 @@ interface BunFile { arrayBuffer(): Promise; json(): Promise; writer(params: { highWaterMark?: number }): FileSink; + exists(): Promise; } export interface FileSink {