Skip to main content

Module raw_transfer

Module raw_transfer 

Source
Expand description

Read-direction buffer serializer for bulk data transfer.

Converts a WorksheetXml and SharedStringTable into a compact binary buffer that can be transferred to JavaScript as a single Buffer object, avoiding per-cell napi object creation overhead.

Binary format (little-endian throughout):

HEADER (16 bytes)
  magic:     u32  = 0x534B5244 ("SKRD")
  version:   u16  = 1
  row_count: u32  = number of rows
  col_count: u16  = number of columns
  flags:     u32  = bit 0: 1=sparse, 0=dense

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

STRING TABLE
  count:     u32
  blob_size: u32
  offsets:   u32[count] (byte offset within blob)
  blob:      concatenated UTF-8 strings (blob_size bytes)

CELL DATA
  Dense:  row_count * col_count * 9 bytes
    per cell: type (u8) + payload (8 bytes)
  Sparse: variable length
    per row: cell_count (u16) + cell_count * 11 bytes
      per cell: col (u16) + type (u8) + payload (8 bytes)

Constants§

CELL_STRIDE
FLAG_SPARSE
HEADER_SIZE
MAGIC
TYPE_BOOL
TYPE_DATE
TYPE_EMPTY
TYPE_ERROR
TYPE_FORMULA
TYPE_NUMBER
TYPE_RICH_STRING
TYPE_STRING
VERSION

Functions§

sheet_to_raw_buffer
Serialize a worksheet’s cell data into a compact binary buffer.