Wat is het LOCKB-bestandsformaat?
Een .lockb-bestand is het binaire lockbestand gemaakt door Bun, de JavaScript- en TypeScript-pakketbeheerder en runtime van Oven. Het heet bijna altijd bun.lockb en bevindt zich in de hoofdmap van een project. Bun schrijft het wanneer u bun install uitvoert, waarbij de volledige opgeloste afhankelijkheidsgrafiek wordt vastgelegd: elk pakket, de exacte versie, de metadata, de sub-afhankelijkheden en integriteitshashes. Door dit alles vast te pinnen, kunnen alle teamleden en CI-taken dezelfde boomstructuur installeren.
Oven heeft het formaat als binair bestand gebouwd voor snelheid. Het slaat gegevens op in lineaire arrays, verwijst naar pakketten via index of via een hash van de pakketnaam, en ontdubbelt lange tekenreeksen. Het bestand opent met de ASCII-header bun-lockfile-format-v0. Het nadeel is dat een binair lockbestand moeilijk te beoordelen is en niet verschijnt in Git-diffs, wat de reden is waarom Bun v1.1.39 een tekst-lockbestand toevoegde en Bun v1.2 bun.lock de standaard maakte voor nieuwe projecten. Bestaande bun.lockb-bestanden werken nog steeds.
Beveiliging & veiligheid
RISICO: 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.
Formaatdetails
in een notendopProgramma's die LOCKB-bestanden openen
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. Technische details
diepe specificaties| 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 |
| Uitgebracht | 2022 |
| Laatste versie | bun-lockfile-format-v0 |
| Specificatie | github.com |
LOCKB conversies
Community V&A
gevraagd door gebruikersNog geen vragen - wees de eerste om iets te vragen over LOCKB-bestanden.
Veelgestelde vragen
Hoe open ik een bun.lockb-bestand?
bun bun.lockb uit. Bun print het lockbestand als leesbare tekst in yarn.lock-stijl. U moet Bun hiervoor geïnstalleerd hebben.Waarom is bun.lockb binair in plaats van tekst?
Moet ik bun.lockb committen aan Git?
Hoe converteer ik bun.lockb naar het nieuwe bun.lock?
bun install --save-text-lockfile --frozen-lockfile --lockfile-only uit en verwijder daarna het oude bun.lockb. Bun v1.2 gebruikt standaard het tekstgebaseerde bun.lock voor nieuwe projecten.Kan ik een bun.lockb-bestand handmatig bewerken?
package.json en voer bun install uit om het lockbestand opnieuw te genereren. Het direct bewerken van het binaire bestand zal het beschadigen.