VelocIXtor — Sovereign Runtime | TerraTech's Bun fork replacing Node.js with Apple's JavaScriptCore engine | Zero Google V8 dependency | TerraCore sovereign runtime stack https://bun.com
Find a file
robobun e2b0d24495
fix(blob): don't set size to 0 for non-seekable files in resolveSize() (#27852)
## Summary
- Fixes `Bun.stdin.stream()` / `Bun.stdin.text()` returning empty after
calling `Bun.stdin.exists()` or accessing `Bun.stdin.size` on Linux
- The root cause was `resolveSize()` falling through to `this.size = 0`
for pipe-backed file descriptors where the size is genuinely unknown
- Added early return in the file store branch of `resolveSize()` so that
non-seekable files (pipes, FIFOs) retain their `max_size` sentinel value

## Root Cause
When `resolveSize()` was called on a pipe fd (e.g. stdin):
1. `resolveFileStat()` sets `seekable = false` and `max_size =
Blob.max_size` (unknown)
2. The condition `seekable != null and max_size != Blob.max_size` fails
(max_size IS max_size)
3. Execution falls through to `this.size = 0`
4. `ReadableStream.fromBlobCopyRef()` passes `max_size = 0` to
`FileReader`
5. `FileReader.onReadChunk()` sees `0 >= 0` and immediately stops — no
data read

## Test plan
- [x] New regression tests in `test/regression/issue/27849.test.ts`
verify `stream()`, `text()`, and `.size` access before reading from a
real pipe
- [x] Tests fail with system bun (`USE_SYSTEM_BUN=1`), pass with debug
build
- [x] Existing blob tests pass (`blob.test.ts`, `bun-file.test.ts`,
`bun-file-exists.test.js`)

Closes #27849

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude Bot <claude-bot@bun.sh>
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-06 18:59:41 -08:00
.buildkite ci: move Windows code signing to dedicated x64 step (#27451) 2026-02-26 17:15:44 -08:00
.claude Upgrade WebKit to d5bd162d9ab2 (#25958) 2026-01-15 10:26:43 -08:00
.cursor chore: convert .cursor/rules to .claude/skills (#25683) 2025-12-24 23:37:26 -08:00
.github Bring back the slop label 2026-02-20 17:54:21 -08:00
.vscode run fmt (#25148) 2025-11-28 17:51:45 +11:00
bench feat: implement Bun.sliceAnsi for ANSI & grapheme-aware string slicing (#26963) 2026-02-26 23:36:42 -08:00
cmake cmake: use buildkite-agent for artifact discovery (#27807) 2026-03-04 16:28:44 -08:00
completions feat(repl): add -e/-p flags, docs page, and shell completions (#27436) 2026-02-25 19:49:44 -08:00
dockerhub test: add regression tests for building docker containers (#25210) 2025-12-01 20:20:06 -08:00
docs docs: Correct code format (#25950) 2026-03-04 13:13:19 -08:00
misctools Update WebKit (#26381) 2026-01-25 10:38:13 -08:00
packages feat(bundler): add --allow-unresolved to gate dynamic import specifiers (#27867) 2026-03-06 18:26:34 -08:00
patches fix(windows): patch libuv to fix pipe data loss from CancelIoEx race (#27535) 2026-02-27 23:30:32 -08:00
scripts Reduce CI test output by using dots reporter (#26860) 2026-03-01 02:06:13 -08:00
src fix(blob): don't set size to 0 for non-seekable files in resolveSize() (#27852) 2026-03-06 18:59:41 -08:00
test fix(blob): don't set size to 0 for non-seekable files in resolveSize() (#27852) 2026-03-06 18:59:41 -08:00
.aikido Add new package paths to .aikido configuration 2025-11-20 17:35:16 -08:00
.clang-tidy Reapply "Convert build scripts to CMake (#13427)" 2024-09-11 08:24:50 -07:00
.clangd meta: fix disabling of clangd auto header insertion (#17172) 2025-02-10 02:04:21 -08:00
.coderabbit.yaml Disable coderabbit enrichment 2025-12-18 18:03:23 -08:00
.cursorignore Update .cursorignore 2024-12-26 11:48:30 -08:00
.dockerignore bump webkit (#15328) 2024-12-12 03:21:56 -08:00
.editorconfig Bring uSockets & uWebSockets forks into Bun's repository (#4372) 2023-08-28 08:38:30 -07:00
.git-blame-ignore-revs Update .git-blame-ignore-revs 2025-06-13 16:16:14 -07:00
.gitattributes add .mdx to .gitattributes (#24525) 2025-11-08 20:56:38 -08:00
.gitignore gitignore: add .direnv dir (#26198) 2026-01-18 00:17:14 -08:00
.lldbinit Move LLDB initialization commands to make attach configuration work (#20085) 2025-05-30 19:33:03 -07:00
.mailmap do not print duplicate code (#16231) 2025-01-07 20:19:12 -08:00
.prettierignore docs: revert minifier doc's format (#24639) 2025-11-12 11:01:25 -08:00
.prettierrc Add new bindings generator; port SSLConfig (#23169) 2025-10-03 17:10:28 -07:00
.typos.toml ci: check for typos in documentation (#16235) 2025-01-08 07:23:54 +00:00
AGENTS.md Make AGENTS.md a symlink to CLAUDE.md 2025-06-27 21:13:21 -07:00
build.zig build: compile windows shim for native arch on aarch64 (#27448) 2026-03-02 01:41:19 -08:00
bun.lock @types/bun: Update to @types/node@25, fallback to PropertyKey in test expect matchers when keyof unknown is used (#25460) 2025-12-10 18:15:55 -08:00
bunfig.node-test.toml node:module compatibility pt 1 (#18106) 2025-03-12 15:47:41 -07:00
bunfig.toml update minimumReleaseAge (#25057) 2025-11-25 11:06:24 -08:00
CLAUDE.md Windows arm64 CI (#26746) 2026-02-18 18:08:10 -08:00
CMakeLists.txt [publish images] Remove sccache, use ccache only (#25682) 2025-12-26 20:24:27 -08:00
CODE_OF_CONDUCT.md Add a code of conduct 2022-09-03 20:54:15 -07:00
CONTRIBUTING.md [publish images] Upgrade LLVM toolchain from 19.1.7 to 21.1.8 (#26667) 2026-02-02 23:12:21 -08:00
entitlements.debug.plist Faster debug builds (#16354) 2025-01-12 20:03:24 -08:00
entitlements.plist New subcommand: bun upgrade. It upgrades bun to the latest version. 2021-10-28 05:34:38 -07:00
flake.lock Add Nix flake for development environment (#23406) 2025-10-10 02:13:28 -07:00
flake.nix [publish images] Upgrade LLVM toolchain from 19.1.7 to 21.1.8 (#26667) 2026-02-02 23:12:21 -08:00
LATEST Bump 2026-02-26 23:02:43 -08:00
LICENSE.md feat(unicode): migrate grapheme breaking to uucode with GB9c support (#26376) 2026-01-23 00:07:06 -08:00
meta.json feat(build): add --metafile-md CLI option for LLM-friendly bundle analysis (#26441) 2026-01-28 18:01:39 -08:00
oxlint.json fix(lint): resolve no-unused-expressions errors (#23127) 2025-09-30 04:45:34 -07:00
package.json Bump 2026-02-26 23:02:43 -08:00
README.md Windows ARM64 2026-02-25 20:55:23 -08:00
rust-toolchain.toml Add step in CI to upload link metadata (#25448) 2025-12-16 14:30:10 -08:00
SECURITY.md bun.sh -> bun.com (#20909) 2025-07-10 00:10:43 -07:00
shell.nix [publish images] Upgrade LLVM toolchain from 19.1.7 to 21.1.8 (#26667) 2026-02-02 23:12:21 -08:00
tsconfig.base.json Add new bindings generator; port SSLConfig (#23169) 2025-10-03 17:10:28 -07:00
tsconfig.json types: Rewrite to avoid conflicts and allow for doc generation (#18024) 2025-03-25 14:33:30 -07:00
workspace.code-workspace go 2021-08-11 13:56:03 -07:00

Logo

Bun

stars Bun speed

Documentation   •   Discord   •   Issues   •   Roadmap

Read the docs →

What is Bun?

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 Zig and powered by JavaScriptCore under the hood, dramatically reducing startup times and memory usage.

bun run index.tsx             # TS and JSX supported out-of-the-box

The bun command-line tool also implements a test runner, script runner, and Node.js-compatible package manager. Instead of 1,000 node_modules for development, you only need bun. Bun's built-in tools are significantly faster than existing options and usable in existing Node.js projects with little to no changes.

bun test                      # run tests
bun run start                 # run the `start` script in `package.json`
bun install <pkg>             # install a package
bunx cowsay 'Hello, world!'   # execute a package

Install

Bun supports Linux (x64 & arm64), macOS (x64 & Apple Silicon) and Windows (x64 & arm64).

Linux users — Kernel version 5.6 or higher is strongly recommended, but the minimum is 5.1.

x64 users — if you see "illegal instruction" or similar errors, check our CPU requirements

# with install script (recommended)
curl -fsSL https://bun.com/install | bash

# on windows
powershell -c "irm bun.sh/install.ps1 | iex"

# with npm
npm install -g bun

# with Homebrew
brew tap oven-sh/bun
brew install bun

# with Docker
docker pull oven/bun
docker run --rm --init --ulimit memlock=-1:-1 oven/bun

Upgrade

To upgrade to the latest version of Bun, run:

bun upgrade

Bun automatically releases a canary build on every commit to main. To upgrade to the latest canary build, run:

bun upgrade --canary

View canary build

Guides

Contributing

Refer to the Project > Contributing guide to start contributing to Bun.

License

Refer to the Project > License page for information about Bun's licensing.