mirror of
https://github.com/oven-sh/bun
synced 2026-02-09 10:28:47 +00:00
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
This commit is contained in:
@@ -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<ArrayBuffer>;
|
||||
json(): Promise<any>;
|
||||
writer(params: { highWaterMark?: number }): FileSink;
|
||||
exists(): Promise<boolean>;
|
||||
}
|
||||
|
||||
export interface FileSink {
|
||||
|
||||
Reference in New Issue
Block a user