LOCKB ファイル形式とは?
.lockbファイルは、OvenによるJavaScriptおよびTypeScriptのパッケージマネージャー兼ランタイムであるBunによって作成されるバイナリロックファイルです。通常、プロジェクトのルートにbun.lockbという名前で配置されます。Bunはbun installの実行時にこれを書き込み、解決された完全な依存関係グラフ(各パッケージ、正確なバージョン、メタデータ、サブ依存関係、整合性ハッシュ)を記録します。これらすべてを固定することで、チームメンバー全員やCIジョブが同じツリーをインストールできるようになります。
Ovenは、速度を重視してこの形式をバイナリとして構築しました。データは線形配列に格納され、パッケージはインデックスまたはパッケージ名のハッシュによって参照され、長い文字列は重複排除されます。ファイルはASCIIヘッダーbun-lockfile-format-v0で始まります。欠点は、バイナリロックファイルはレビューが難しく、Gitの差分(diff)に表示されないことです。そのため、Bun v1.1.39でテキストロックファイルが追加され、Bun v1.2では新規プロジェクトのデフォルトがbun.lockになりました。既存のbun.lockbファイルは引き続き動作します。
セキュリティと安全性
リスク: LOWA bun.lockb file is generated data, not an executable, so opening or committing it is safe. Bun can 'run' the file only in the sense that bun ./bun.lockb prints its contents; it does not execute arbitrary code from the file. The only real caution is supply-chain trust: the lockfile pins specific package versions and their sources, so review dependency changes as you would any lockfile update. Never edit it by hand, since a corrupted binary lockfile will fail to parse.
形式の詳細
概要LOCKB ファイルを開くプログラム
bun bun.lockb in the project directory to print the lockfile as readable yarn.lock-style text, or bun install to use it. bun.lockb. bun.lockb and print its contents without installing Bun. bun bun.lockb to print the lockfile as readable text, or bun install to reinstall from it. bun.lockb as text inside the editor. bun.lockb contents in Node or the browser without Bun installed. bun bun.lockb for a readable text dump, or bun install to install dependencies from it. bun.lockb as readable text. git config diff.lockb.textconv bun so git diff shows bun.lockb changes as readable text. 技術的詳細
詳細仕様| Encoding | Binary (serialized struct-of-arrays memory dump) |
| Byte order | Little-endian (native to the machine that wrote it) |
| Container | Flat custom binary format, not a standard container |
| Compression | None; long strings over 88 characters are deduplicated to save space |
| Typical size | A few KB to a few hundred KB depending on dependency count |
| Structure | A header/magic string followed by linear arrays: package list, string buffer, dependency slices, resolutions, and hoisting trees. Packages are referenced by an auto-incrementing index or a hash of the package name rather than by repeated name strings. |
| Integrity | Stores npm-style integrity hashes for each resolved package; the format itself is version-tagged via the header string |
| Platforms | Windows, macOS, Linux |
| Notes | Designed for fast reads and memory mapping. It is not human-readable and does not render in Git or GitHub diffs without a textconv helper. Superseded as the default by the text-based bun.lock (JSONC) in Bun v1.2, but still supported. |
| Human Readable | No |
| リリース日 | 2022 |
| 最新バージョン | bun-lockfile-format-v0 |
| 仕様書 | github.com |
LOCKB の変換
コミュニティ Q&A
ユーザーからの質問まだ質問はありません。LOCKB ファイルについて最初の質問をしてみましょう。
よくある質問
bun.lockbファイルを開くにはどうすればよいですか?
bun bun.lockbを実行してください。Bunはロックファイルを読み取り可能なyarn.lock形式のテキストとして出力します。これにはBunのインストールが必要です。なぜbun.lockbはテキストではなくバイナリなのですか?
bun.lockbをGitにコミットすべきですか?
bun.lockbを新しいbun.lockに変換するにはどうすればよいですか?
bun install --save-text-lockfile --frozen-lockfile --lockfile-onlyを実行し、古いbun.lockbを削除してください。Bun v1.2以降、新規プロジェクトではテキストベースのbun.lockがデフォルトで使用されます。bun.lockbファイルを手動で編集できますか?
package.jsonで依存関係を変更し、bun installを実行してロックファイルを再生成してください。バイナリを直接編集すると破損します。