Che cos'è il formato di file LOCKB?
Un file .lockb è il lockfile binario creato da Bun, il package manager e runtime JavaScript e TypeScript di Oven. È quasi sempre chiamato bun.lockb e si trova nella root di un progetto. Bun lo scrive quando si esegue bun install, registrando l'intero grafo delle dipendenze risolto: ogni pacchetto, la sua versione esatta, i suoi metadati, le sue sottodipendenze e gli hash di integrità. Bloccare tutto questo permette a ogni membro del team e ai job di CI di installare lo stesso albero.
Oven ha progettato il formato come binario per motivi di velocità. Memorizza i dati in array lineari, fa riferimento ai pacchetti tramite indice o tramite un hash del nome del pacchetto e deduplica le stringhe lunghe. Il file si apre con l'intestazione ASCII bun-lockfile-format-v0. Lo svantaggio è che un lockfile binario è difficile da revisionare e non appare nei diff di Git, motivo per cui Bun v1.1.39 ha aggiunto un lockfile testuale e Bun v1.2 ha reso bun.lock l'impostazione predefinita per i nuovi progetti. I file bun.lockb esistenti continuano a funzionare.
Sicurezza e incolumità
RISCHIO: 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.
Dettagli del formato
in sintesiProgrammi che aprono file 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. Dettagli tecnici
specifiche approfondite| 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 |
| Rilasciato | 2022 |
| Ultima versione | bun-lockfile-format-v0 |
| Specifica | github.com |
Conversioni LOCKB
Domande e risposte della community
chiesto dagli utentiAncora nessuna domanda - sii il primo a chiedere informazioni sui file LOCKB.
Domande frequenti
Come si apre un file bun.lockb?
bun bun.lockb. Bun stamperà il lockfile come testo leggibile in stile yarn.lock. È necessario che Bun sia installato.Perché bun.lockb è binario invece che testuale?
Dovrei fare il commit di bun.lockb su Git?
Come converto bun.lockb nel nuovo bun.lock?
bun install --save-text-lockfile --frozen-lockfile --lockfile-only, quindi elimina il vecchio bun.lockb. Bun v1.2 utilizza il file testuale bun.lock per impostazione predefinita per i nuovi progetti.Posso modificare un file bun.lockb a mano?
package.json ed esegui bun install per rigenerare il lockfile. Modificare direttamente il binario lo corromperà.