Skip to content

readFrameAt

readFrameAt(bytes, offset): Frame

Defined in: packages/distillate/src/core/serialize.ts:328

Reads and validates the frame starting at offset in bytes, which may hold further frames after it: magic, version, declared length, CRC32 and reserved bits, without needing to know the structure type. Advance by the returned byteLength to walk a buffer of concatenated frames.

Uint8Array

number

Frame

TruncatedError when the frame runs past the end of bytes.

BadMagicError, UnknownVersionError, ChecksumError or ReservedBitsError when the frame at offset is not one this release reads.

RangeError when offset is not a non-negative integer.