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

Welcome to Bun | Bun Docs

自动蜘蛛 bun.sh 正文约 2981 字
Welcome to Bun | Bun Docs
File & Module System
Standards & Compatibility
Bun is an all-in-one toolkit for developing modern JavaScript/TypeScript applications.
A fast JavaScript runtime designed as a drop-in replacement for Node.js
Install packages up to 30x faster than npm with a global cache and workspaces
Jest-compatible, TypeScript-first tests with snapshots, DOM, and watch mode
Bundle TypeScript, JSX, React & CSS for both browsers and servers
Bun ships as a single, dependency-free binary and includes a runtime, package manager, test runner, and bundler. New to Bun?
Supported platforms and all install methods.
Hello world in minutes with Bun.serve.
Explore each area using the cards above. Each section is structured with an overview, short examples, reference, and best practices for fast scanning and deep dives.
Bun is an all-in-one toolkit for JavaScript and TypeScript apps. It ships as a single executable called bun.
At its core is the Bun runtime, a fast JavaScript runtime designed as a drop-in replacement for Node.js. It's written in Rust and powered by JavaScriptCore, reducing startup time and memory usage.
The bun command-line tool also implements a test runner, script runner, and Node.js-compatible package manager. All three are significantly faster than existing tools, and you can use them in existing Node.js projects with little to no changes.
JavaScript (or, more formally, ECMAScript) is only a specification for a programming language. Anyone can write a JavaScript engine that ingests a valid JavaScript program and executes it. The two most popular engines in use today are V8 (developed by Google) and JavaScriptCore (developed by Apple). Both are open source.
But most JavaScript programs don't run in a vacuum. They need a way to access the outside world to perform useful tasks. This is where runtimes come in. They implement additional APIs and make them available to the JavaScript programs they execute.
Browsers ship with JavaScript runtimes that implement a set of Web-specific APIs, exposed on the global window object. Any JavaScript code executed by the browser can use these APIs to add interactive or dynamic behavior to the current webpage.
Node.js is a JavaScript runtime for non-browser environments, like servers. JavaScript programs executed by Node.js have access to a set of Node.js-specific globals like Buffer, process, and __dirname in addition to built-in modules for OS-level tasks like reading/writing files (node:fs) and networking (node:net, node:http). Node.js also implements a CommonJS-based module system and resolution algorithm that pre-dates JavaScript's native module system.
Bun is designed as a faster, leaner, more modern replacement for Node.js.
Bun is designed from the ground-up with today's JavaScript ecosystem in mind.
Bun is more than a runtime. The long-term goal is a cohesive, infrastructural toolkit for building apps with JavaScript/TypeScript: a package manager, transpiler, bundler, script runner, and test runner.
访问原文 返回搜索 https://bun.sh/docs
本页为82搜索生成的网页快照,内容来自站内索引;演示数据的原文链接仅作示例。