Previous: , Up: Encoding   [Index]


BLOB

BLOB (binary large object) allows you to transfer binary data in chunks, in a streaming way, when data may not fit in memory.

64-bit big-endian integer follows the BLOB tag, setting the following chunks payload size (+1). Then come one or more BIN strings with the chunk-length payload. All of them, except for the last one, must have fixed chunk length payload. Last terminating string’s payload must be shorter.

Data format definition must specify exact chunk size expected to be used, if it needs deterministic encoding.

BLOB chunk-len [BIN(len=chunk-len) || ...] BIN(len<chunk-len)
BLOB(5, "")0B 0000000000000004 80
BLOB(5, "12345")0B 0000000000000004 85 3132333435 80
BLOB(5, "123456")0B 0000000000000004 85 3132333435 81 36
BLOB(500, "123")0B 00000000000001F3 83 313233
BLOB(2, "12345")0B 0000000000000001 82 3132 82 3334 81 35