---
name: Read a file as a string
---
The `Bun.file()` function accepts a path and returns a `BunFile` instance. The `BunFile` class extends `Blob` and allows you to lazily read the file in a variety of formats. Use `.text()` to read the contents as a string.
```ts
const path = "/path/to/file.txt";
const file = Bun.file(path);
const text = await file.text();
// string
```
---
Any relative paths will be resolved relative to the project root (the nearest directory containing a `package.json` file).
```ts
const path = "./file.txt";
const file = Bun.file(path);
```
a>
|
Unnamed repository; edit this file 'description' to name the repository. | |
Age | Commit message (Collapse) | Author | Files | Lines |
|
* Expose name on host component for Vue devtools
* Add changeset
* Update changeset to patch from minor
* [ci] collect stats
* [ci] collect stats
Co-authored-by: leviceccato <leviceccato@users.noreply.github.com>
Co-authored-by: Matthew Phillips <matthew@matthewphillips.info>
|
|
* chore: add description to avoid type error
* fix: fix canonical url type in main head component
|
|
* Add Vercel sponsorship logo
Also normalize other logos
* Add Vercel logo to www
* Add logos to docs
|
|
|
|
|
|
|
|
|
|
* Separate object for featured and community themes
I've split up the two so there's the featured one at the top at the page and community ones below the official themes
* Add community themes and change featured themes
* Add comma after featured object
|
|
|
|
|
|
|
|
|