This release fixes 95 issues (addressing 348 👍 reactions)!
To install Bun
curl -fsSL https://bun.sh/install | bashnpm install -g bunpowershell -c "irm bun.sh/install.ps1|iex"scoop install bunbrew tap oven-sh/bunbrew install bundocker pull oven/bundocker run --rm --init --ulimit memlock=-1:-1 oven/bunTo upgrade Bun
bun upgradeCompressionStream and DecompressionStream
Bun now implements CompressionStream and DecompressionStream. These standard Web APIs allow for streaming compression and decompression of data without buffering the entire payload in memory.
In addition to the standard "gzip", "deflate", and "deflate-raw" formats, Bun also supports "brotli" and "zstd".
const response = await fetch("https://example.com");
// Compress the response body using gzip
const compressed = response.body.pipeThrough(new CompressionStream("gzip"));
// Or use zstd for faster compression
const zstd = response.body.pipeThrough(new CompressionStream("zstd"));
Thanks to @nektro for the contribution!
Control .env and bunfig.toml loading in standalone executables
Standalone executables created with bun build --compile normally look for .env and bunfig.toml files in the directory where the executable is run. You can now disable this behavior at build time using the --no-compile-autoload-dotenv and --no-compile-autoload-bunfig flags.
This is useful when you want to ensure the executable behaves deterministically, regardless of the configuration files present in the user's working directory.
# Disable .env and bunfig.toml loading
bun build --compile --no-compile-autoload-dotenv --no-compile-autoload-bunfig app.ts
You can also configure this via the JavaScript API:
await Bun.build({
entrypoints: ["./app.ts"],
compile: {
// Disable .env loading
autoloadDotenv: false,
// Disable bunfig.toml loading
autoloadBunfig: false,
},
});
retry and repeats in bun:test
You can now use the retry and repeats options in bun:test. retry runs the callback function up to the specified number of times and if the test passes once then the test passes, while repeats runs the callback function up to the specified number of times and if the test fails once then the test fails. This is useful for handling flaky tests.
import { test } from "bun:test";
test(
"flaky test",
() => {
if (Math.random() > 0.1) throw new Error("fail");
},
{ retry: 3 },
);
test(
"check for flakiness",
() => {
// run this 20 times to ensure it's stable
},
{ repeats: 20 },
);
Thanks to @pfgithub for the contribution!
--no-env-file
You can now disable Bun's automatic .env file loading using the --no-env-file flag. This is useful in production environments or CI/CD pipelines where you want to rely solely on system environment variables.
bun run --no-env-file index.ts
This can also be configured in bunfig.toml:
# Disable loading .env files
env = false
Explicitly provided environment files via --env-file will still be loaded even when default loading is disabled.
SQLite 3.51.0
bun:sqlite has been updated to SQLite v3.51.0.
import { Database } from "bun:sqlite";
const db = new Database();
console.log(db.prepare("SELECT sqlite_version()").get());
// { "sqlite_version()": "3.51.0" }
Internal: Upgraded to Zig 0.15.2
Bun is now built with Zig 0.15.2. This reduces the binary size by 0.8MB and improves build times for contributors.
Bundler fixes
- Fixed: A rare panic in the dev server when processing CSS assets in the incremental graph
- Fixed: A rare panic in the dev server that could occur when a file referenced by a dynamic import is deleted during a reload
bun install fixes
- Fixed: A rare crash during
bun installinvolving optional peer dependencies - Fixed: A regression in
bun installwhen parsing git dependency URLs with a leading hash - Fixed: A regression from Bun v1.3.2 that could cause
bun ls --allwith unresolved optional peer dependencies to crash - Fixed: A regression from Bun v1.3.2 where
sharpversions older than v0.33.0 failed to install correctly
Windows fixes
- Fixed:
process.stdoutnow emits'resize'events andSIGWINCHsignals on Windows, which fixes terminal resizing issues in Claude Code & OpenCode on Windows - Improved:
bun getcompletesworks on Windows - Fixed: a crash on Windows when laptop hibernates and then wakes up and resumes execution after a Worker thread had been terminated
Node.js compatibility improvements
- Implemented:
_handle.fdinnode:netandnode:tlsfor better compatibility with libraries that rely on the socket file descriptor - Fixed: N-API bug preventing
rspackorrsbuildfrom working
Web APIs fixes
- Fixed: fuzzer-discovered crash when using JSON.stringify on a FormData object in rare cases
- Fixed: fuzzer-discovered crash when calling
streamon a Blob in certain edge cases - Fixed: sanitizer-discovered memory leak in
Blob
Bun.serve
- Fixed: An issue where Unicode characters in
Bun.servestaticResponseobjects given a string as input were missing theContent-Typeheader
Networking
- Fixed: sanitizer-discovered memory leak in
node:net.SocketAddresswhen passing an invalid port - Fixed: sanitizer-discovered memory leak in
Bun.listenwhen errors are thrown during socket creation
YAML
- Fixed:
Bun.YAML.stringifywould incorrectly serialize strings with leading zeros as numbers - Fixed: A performance issue where YAML merge keys could cause parsing to hang due to exponential complexity
Transpiler
- Fixed: fuzzer-discovered crash in
new Bun.Transpiler()with invalid configuration
Bun.spawn
- Fixed: A small memory leak in
Bun.spawnwhen passing extra non-IPC, non-stdout, non-stderr, and non-stdin file descriptors
TypeScript definitions
- Fixed: Added JSDoc documentation for
configVersioninBunLockFiletype definition - Fixed: Added missing
"css","jsonc","yaml", and"html"to theLoadertype definition - Fixed: Removed unnecessary dependency on
@types/reactin@types/bun
Security
- Fixed: Updated root certificates to Mozilla NSS 3.117
bun upgrade fixes
- Improved:
bun upgradenow displays download sizes in human-readable units (e.g.23.2MiB) instead of raw bytes