Bun provides fast file reading withDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/zhcndoc/bun/llms.txt
Use this file to discover all available pages before exploring further.
Bun.file().
Powered by Mintlify
Auto-generate your docs
Read text files with Bun
Bun provides fast file reading withDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/zhcndoc/bun/llms.txt
Use this file to discover all available pages before exploring further.
Bun.file().
const file = Bun.file("data.txt");
const text = await file.text();
console.log(text);
import { readFileSync } from "node:fs";
const text = readFileSync("data.txt", "utf-8");
console.log(text);
try {
const file = Bun.file("data.txt");
const text = await file.text();
console.log(text);
} catch (error) {
console.error("Failed to read file:", error);
}