网页 综合 更新时间 2026-11-14 03:58:48

Bun — A fast all-in-one JavaScript runtime

自动蜘蛛 bun.sh 正文约 3457 字
Bun — A fast all-in-one JavaScript runtime
Runtime, package manager, test runner, bundler, type checker and formatter in a single binary. Use bun install or bun test in an existing Node.js project, or run the whole thing on Bun.
warm cache · seconds (lower is better)
hello-world app · requests per second (higher is better)
100 rows × 100 queries in flight · queries per second (higher is better)
32 clients broadcasting · messages per second (higher is better)
bun install and bun test drop into existing Node.js projects. No runtime switch required.
Runs JavaScript & TypeScript on JavaScriptCore. Node.js APIs, node_modules and your framework work as-is.
Replacesnodets-nodetsxnodemon
Each group has its own scale. Linux x64, EPYC 9R14, medians of 3.
npm-compatible. Workspaces, catalogs, overrides, patches and a lockfile you can read.
T3-stack Next.js app, 25 direct dependencies, ~220 packages in the lockfile. bun v1.4, npm v12.0.2, pnpm v11.21.0, yarn v1.22.22. Linux x64, medians of 3.
Has a Jest-compatible expect(), mocks, snapshots, DOM testing and coverage, and starts in milliseconds.
Same tests, same machine. Jest configured with each transformer's defaults.
TS, JSX, CSS & HTML for browsers and servers. Dev server with hot reloading. Single-file executables.
Replacesesbuildvitewebpack
Linux x64, bench/bundle in oven-sh/bun.
Passes 100% of TypeScript 7.0.2's conformance test suite. Reads your tsconfig.json and reports the same errors as tsc.
Each project has its own scale. 16-core Apple silicon Mac, from the Bun v1.4.3 release.
Works with your Prettier or oxfmt config. In Prettier's own repo (2,616 files), bun fmt --check takes 60 ms and Prettier takes 17 seconds.
Replacesprettieroxfmt
Each project has its own scale. vite on an M4 Max, the rest on a Xeon 8488C. From the Bun v1.4.4 release.
Most servers need an HTTP stack, a database client, Redis, S3, hashing and a way to shell out. Bun ships all of them, so that is a stack of packages you never install or patch.
Bun.serve() with routes, params and static responses.
Pub/sub WebSocket server, built into Bun.serve().
Bun.sql — tagged templates, pipelining, transactions.
A fast Redis client with Pub/Sub — no driver to install.
Read, write and presign objects on any S3-compatible store.
Bun.$ — cross-platform bash-like scripting with JS interop.
bun test — Jest-compatible, concurrent, instant startup.
argon2 & bcrypt hashing without native addons.
Import an HTML file and you have a full-stack dev server.
Call into C, Rust or Zig shared libraries.
Claude Code ships to millions of developers as a Bun executable. Midjourney pushes every image notification through Bun's WebSocket server. Railway runs its serverless functions on it. Hear it from them:
Claude Code is a single file with Bun inside it. Users download it and run it. There is no install step and no startup lag.
Pub/sub, backpressure and per-message compression are built into Bun.serve(), so there is no WebSocket library to install.
A Railway Function is a TypeScript file. Bun runs it as-is, so a deploy skips the build and a cold start takes milliseconds.
Frameworks built for Node.js run on Bun. Swap npm run dev for bun --bun run dev and you can use Bun's SQL, S3 and shell APIs in your route handlers.
Bun v1.4.4, October 2026
Install Bun, open the project you were already working on, and run bun install. Your code, dependencies and scripts stay exactly as they are.
The fast all-in-one JavaScript runtime & toolkit. Now part of Anthropic.
本页为82搜索生成的网页快照,内容来自站内索引;演示数据的原文链接仅作示例。