Type-check a TS project: tsc-identical errors, 3-6x faster, no typescript install | bun check --no-script, bun run/test/build --check | tsc, tsgo | dev-tooling |
| Format with your Prettier/oxfmt config | bun fmt --no-script (--check, --changed, --staged) | prettier, oxfmt, lint-staged | dev-tooling |
Run shell commands from JS, no /bin/sh | Bun.$`...` → .nothrow().quiet().text()/.json()/.lines() | execa, zx, shelljs | session-recipes |
| Spawn with timeout / PTY / IPC; measure a child | Bun.spawn({ env: process.env, timeout, killSignal, terminal, ipc }), proc.resourceUsage() | node-pty, tree-kill, pidusage | session-recipes |
| Keep tokens out of files, argv and env dumps | Bun.secrets.get/set (OS keychain), --env-file=/dev/stdin | keytar, dotenv | session-recipes |
| Resize/convert/rotate images | Bun.file(p).image().resize().webp().write() | sharp | runtime-apis |
| Headless browser: navigate, click, screenshot, evaluate, CDP | new Bun.WebView() | puppeteer, playwright (scraping) | runtime-apis |
| Scrape or rewrite HTML by CSS selector, streaming | new HTMLRewriter().on("a[href]", { element }) | cheerio, jsdom (scraping) | runtime-apis |
| Markdown → HTML / React / ANSI | Bun.markdown.html() / .react() / .ansi() | marked, react-markdown, glow | runtime-apis |
| Schedule cron jobs | Bun.cron() | node-cron | runtime-apis |
| Run package scripts concurrently, glob-matched | bun run --parallel "build:*" | concurrently, npm-run-all | runtime-apis |
| Parse JSON5 / JSONL / JSONC / XML / TOML / YAML; tarballs; globs | Bun.JSON5/.JSONL/.JSONC/.XML/.TOML/.YAML, Bun.Archive, Bun.Glob | json5, ndjson, jsonc-parser, fast-xml-parser, @iarna/toml, js-yaml, tar, fast-glob | runtime-apis |
| ANSI-aware terminal text; table rendering | Bun.stringWidth/sliceAnsi/wrapAnsi/stripANSI(), Bun.inspect.table() | string-width, slice-ansi, wrap-ansi, strip-ansi, cli-table | runtime-apis |
| Hash, UUID v7, semver, deep-equal, gzip/zstd, which | Bun.hash/CryptoHasher/password, randomUUIDv7, Bun.semver, deepEquals, gzipSync/zstdCompressSync, Bun.which | uuid, semver, lodash.isequal, pako, which | runtime-apis |
| Postgres / MySQL / SQLite, Redis, S3-compatible (R2) clients | Bun.SQL, bun:sqlite, Bun.RedisClient, Bun.S3Client / s3:// | pg, mysql2, better-sqlite3, ioredis, aws-sdk | runtime-apis |
| Serve a static dir (ETag/Range/304 handled) | Bun.serve({ routes: { "/x/*": { dir } } }) | express.static, serve-static, sirv | http-networking |
| HTTP/2 + HTTP/3 server; fetch protocol/compress/proxy; per-client pools | http2: true, http3: true, fetch(url, { protocol, compress, proxy }), new Bun.FetchSession() | undici Agent | http-networking |
| Stream a download to disk; replay a request as curl | Bun.write(path, await fetch(url)), BUN_CONFIG_VERBOSE_FETCH=curl | pipeline + createWriteStream | http-networking |
| Tests across CPU workers / CI shards / changed files / flaky retry | bun test --parallel --shard=1/3 --changed=main --retry=3 | jest/vitest infra | test |
| Kill "passes alone, fails in suite" bugs; hunt flakes | bun test --isolate, --rerun-each N, --only-failures | vitest default behavior | test |
| Single-file executables with embedded assets and profile-guided startup; feature flags; in-memory bundling; metafile; React Compiler | bun build --compile --bytecode --bytecode-order=<profile> --asset ./public, bun:bundle feature(), files:{}, metafile: true, --react-compiler | pkg hacks, esbuild define/plugins, babel-plugin-react-compiler | build |
| Diff package versions, fix vulns, dedupe/prune, licenses, explain a dep | bun pm diff, bun audit fix, bun dedupe, bun prune, bun pm licenses, bun why | npm-diff, npm audit fix, npm ls | install |
| Offline / cached installs; Docker layers; CI cache; 7x faster CI | bun install --offline|--prefer-offline, bun pm fetch, bun pm cache pack|unpack, linker = "isolated" | pnpm store | install |
| Profile CPU/heap/bundle as grep-able Markdown | bun --cpu-prof-md, --heap-prof-md, bun build --metafile-md | Chrome DevTools round-trip | dev-tooling |
Run untrusted JS without eval / new Function / FFI | --disallow-code-generation-from-strings=strict, --no-ffi-cc | vm2 | security |
Run Playwright, vitest, Next.js 16, OpenTelemetry, dd-trace; undici, node-fetch, ws | they now just work (the last three load Bun's builtin even when installed) | Node.js | node-compat-platforms |