Bun It is a high-performance “family bucket” JavaScript runtime written in Zig language, officially called “”all-in-one JavaScript runtime”.Bun provides functionality for packaging, transpiling, installing and running JavaScript & TypeScript projects, built-in native bundler, transpiler, task runner, npm client, and fetch
,WebSocket
etc. Web API.
Bun is a new:
- JavaScript runtime with Web API, built-in
fetch
,WebSocket
Wait API. bun embeds JavaScriptCore, which tends to be faster and more memory efficient than more popular engines like V8 (though harder to embed) - JavaScript/TypeScript/JSX Transpiler
- JavaScript and CSS bundler
- Task runner for package.json scripts
- npm compatible package manager
Bun’s HTTP server is based on web standards such as Request and Response:
// http.js
export default {
port: 3000,
fetch(request) {
return new Response("Welcome to Bun!");
},
};
Bun was built from scratch, targeting modern JavaScript runtimes like Node.js and Deno.
Designed to replace current JavaScript and TypeScript applications or scripts, Bun natively implements hundreds of Node.js and Web APIs, including about 90% of Node-API function(native modules), fs, path, Buffer, etc.
Bun’s goal is to run most of the world’s JavaScript outside the browser, bringing performance and complexity enhancements to future infrastructures and improving developer productivity with better, simpler tools.
- Built-in Web APIs like fetch, WebSocket, and ReadableStream
- The node_modules bun implements Node.js’s module resolution algorithm, so you can use npm packages in the bun. ESM and CommonJS are supported, but Bun uses ESM internally
- In Bun, every file is transpiled. TypeScript and JSX can be used
- Bun supports “paths”, “jsxImportSource” etc from tsconfig.json file.
- Bun.Transpiler Bun’s JsX and TypeScript transpilers are available as APIs in Bun.
- Write, copy, pipe, send and clone files using the fastest system calls provided by Bun.write.
- Bun automatically loads environment variables from .env files. require(“dotenv”).config() is no longer needed
- Bun provides a fast SQLite3 client with built-in bun:sqlite.
- Node-API Bun implements most of Node-API (N-API).Many Node.js native modules are available
- bun:ffi uses Bun’s low-overhead foreign function interface to call native code from JavaScript.
- The node:fs node:path Bun natively supports a growing number of Node.js core modules, as well as globals like Buffer and process.
Comparison of performance test results:
▲ Server-side rendering (HTTP requests per second)
▲ Loading large data tables (average requests per second)
#Bun #Homepage #Documentation #Downloads #Family #Bucket #JavaScript #Runtime #News Fast Delivery