Bring these concepts with you
Your implementation
- Download starter.mjs, sample.bin, and checks.mjs into the same folder.
- Inspect the first 8 bytes of the buffer: verify the 4-byte magic signature 'PACK' (0x50, 0x41, 0x43, 0x4B).
- Read the 2-byte major/minor version (uint16) and 2-byte flags (uint16) in Little-Endian format. Reject buffers that are too small or have mismatched magic bytes.
function parseHeader(buffer) {
// Validate buffer size, check magic bytes ('PACK'), and extract version.
}Need a hint?
- Use buffer.subarray(0, 4).toString('ascii') to verify the magic bytes.
- Check buffer.length < 16 before attempting to read header fields to prevent out-of-bounds errors.
Saved on this device · 0 / 6000 · Do not include passwords or private data.
Acceptance checks
From the folder containing your downloaded files, run:
node checks.mjs ./starter.mjs 1 through 6 1This runs checks up to this step. Earlier steps must work first. Mark each result only after checking your implementation; the website does not run or grade it.
Record your attempt to enable the checklist and reference comparison.
Compare with the reference
Attempt the step first, then compare decisions and behavior. There can be more than one correct implementation.
Your interviewer asks
Why do binary file formats place a fixed magic signature at byte offset zero rather than relying on file extensions?
Say your answer aloud, then record the trade-offs and evidence in your notes above.