Utilities
Static Files
Serve static assets efficiently.
Static
Serve HTML, CSS, Images, and other static assets using Bun's optimized file system API.
Installation
bun add @bklarjs/staticnpm install @bklarjs/staticUsage
import { serveStatic } from "@bklarjs/static";
// Serve files from the "public" folder at the root URL
app.use(
serveStatic({
root: "public",
prefix: "/",
})
);Now requests to http://localhost:3000/logo.png will serve public/logo.png.