Skip to main content

Module raw_transfer_v2

Module raw_transfer_v2 

Source
Expand description

Read-direction buffer serializer v2 for bulk data transfer.

Converts a WorksheetXml and SharedStringTable into a compact binary buffer with inline strings, eliminating the global string table that v1 required. This allows incremental (row-by-row) decoding on the JS side without eagerly materializing all strings upfront.

Binary format (little-endian throughout):

HEADER (16 bytes)
  magic:     u32  = 0x534B5232 ("SKR2")
  version:   u16  = 2
  row_count: u32  = number of rows
  col_count: u16  = number of columns
  flags:     u32  = bit 0: always 0 (v2 is always sparse)
                     bits 16..31: min_col (1-based)

ROW INDEX (row_count * 8 bytes)
  per row: row_number (u32) + byte_offset (u32) into CELL DATA section
  offset = 0xFFFFFFFF for empty rows

CELL DATA (variable length)
  per row: cell_count (u16) + cells
  per cell: col (u16) + type (u8) + payload
    0x00 (empty):  0 bytes
    0x01 (number): 8 bytes (f64 LE)
    0x02 (string): 4 bytes (len u32 LE) + N bytes (UTF-8)
    0x03 (bool):   1 byte
    0x04 (date):   8 bytes (f64 LE, Excel serial)
    0x05 (error):  4 bytes (len u32 LE) + N bytes (UTF-8)
    0x06 (formula): 4 bytes (len u32 LE) + N bytes (UTF-8, cached formula text)
    0x07 (rich):   4 bytes (len u32 LE) + N bytes (UTF-8)

Constants§

HEADER_SIZE
MAGIC_V2
TYPE_BOOL
TYPE_DATE
TYPE_EMPTY
TYPE_ERROR
TYPE_FORMULA
TYPE_NUMBER
TYPE_RICH_STRING
TYPE_STRING
VERSION_V2

Functions§

sheet_to_raw_buffer_v2
Serialize a worksheet’s cell data into a compact binary buffer using v2 format.