Function buildPack
-
buildPack(
state: BundleState,
blockRows?: number,
maxFrameBytes?: number,
): Promise<{ bytes: Bytes; index: BundleIndex }>Parameters
- state: BundleState
- blockRows: number = BLOCK_ROWS
- maxFrameBytes: number = MAX_BUNDLE_FRAME_BYTES
Returns Promise<{ bytes: Bytes; index: BundleIndex }>
Encodes a state as a pack: an index frame, then one frame per block in table order. Empty tables are left out. Throws
bad-bundlefor a repeated key, a block size under one, or a block overmaxFrameBytesorMAX_BUNDLE_BLOCK_BYTES, which a reader would refuse.