Under The Hood
frontend bun Bun 1.x (`bun install`)

bun install: Content-Addressable Global Cache & Linux clonefile/reflink

Last updated
Prerequisites:
npm/yarn/pnpm package managers
File system hardlinks vs symlinks
  • bun
  • package-manager
  • bun-install
  • hardlinks
  • clonefile
  • reflink

Read at your depth

The practical view

`bun install` is a drop-in replacement for `npm install` that is up to 25x faster. It uses a binary lockfile (`bun.lockb` or text `bun.lock` in Bun 1.2+) and a centralized global package cache located at `~/.bun/install/cache`. Instead of copying files, it uses the fastest available filesystem linking mechanism for your operating system.

The same idea in other frameworks

npm equivalent
`npm install` (copies full files into `node_modules` per project).

Legacy vs modern

npm install vs bun install

`npm install` takes minutes downloading and copying duplicate node_modules; `bun install` links in milliseconds.

before → after
npm install (Slow I/O Copy)
npm install // ❌ Takes 30-90s, duplicates gigabytes of files across projects
bun install (Instant CoW Links)
bun install // ✅ NEW: Executes in <500ms using native OS clonefile

Interview gotchas

Context

Interviewers test your knowledge of Bun's lockfile format and Git diffing.

The mechanical answer

`bun.lockb` is Bun's original **binary lockfile** format, designed for instant parsing without JSON deserialization overhead (saving ~100ms on startup). In Bun 1.2+, Bun introduced a human-readable text lockfile **`bun.lock`** (similar to yarn/pnpm) to make Git merge conflict resolution and code review diffs easy while retaining high install speeds.

Trap

You can inspect a binary `bun.lockb` in the terminal at any time by running `bun bun.lockb` or `bun lockfile`.

Under The Hood — a multi-depth technical interview hub.

Third-party licenses Press ⌘ K to search.