Reading chunks
BLF chunk headers (signature, length, version) are always big-endian. The endian argument to the helpers below applies to the chunk payload only.
Instantiate and decode
Each chunk is a class from a version bundle. Create an instance, then decode into it in place:
const chdr = new s_blf_chunk_content_header();
find_chunk(file, chdr, "big");Every chunk implements read(bytes, endian) (header + payload) and read_body(payload, endian) (payload only). Discovery helpers call read for you.
find_chunk
Walks the buffer from the start as a BLF file: read each chunk header in order until the requested signature matches, then decode that chunk in place.
import { find_chunk } from "@blamnetwork/blf";
const found = find_chunk(file, chunk, "big");Use this when the buffer is a normal BLF (a .blf on disk, or bytes you know are laid out as consecutive BLF chunks).
search_for_chunk
Scans every byte offset for the chunk signature, then decodes the first match in place.
import { search_for_chunk } from "@blamnetwork/blf";
const found = search_for_chunk(file, chunk, "big");Use this when the buffer does not only contain a BLF — for example, reading a gametype variant out of a larger Xbox 360 console dump where the mpvr / gvar chunk is embedded among other data. find_chunk assumes valid BLF structure from offset 0; search_for_chunk does not.
Pass "little" when the payload is little-endian (for example Reach MCC hopper chdr metadata). Headers are still read as big-endian.
Fileshare metadata (_fsm)
MCC fileshare exports append a _fsm 1.1 chunk (464 bytes) with digests, a PlayFab-style item id, and an attestation blob. Use search_for_chunk when the buffer is a full BLF that ends with _eof then _fsm:
import { search_for_chunk } from "@blamnetwork/blf";
import { s_blf_chunk_fileshare_metadata } from "@blamnetwork/blf/mcc/v2025_08_16_178512_1_release";
const fsm = new s_blf_chunk_fileshare_metadata();
if (search_for_chunk(file, fsm, "big")) {
console.log(fsm.unknown98); // 40-char hex item id
}See MCC v2025_08_16_178512_1_release for the version bundle (s_blf_chunk_fileshare_metadata source).
Errors
Layout and chunk failures throw BlfError.
See also: Writing chunks.