Skip to main content

Crate tensogram_wasm

Crate tensogram_wasm 

Source
Expand description

WebAssembly bindings for the Tensogram N-tensor message format.

Provides encode, decode, scan, streaming decode, range decode, hash, validation, pre-encoded encode, simple_packing params, and a frame-at-a-time StreamingEncoder — accessible from JavaScript / TypeScript via wasm-bindgen.

Tensor payloads are returned as zero-copy TypedArray views into WASM linear memory for 60fps visualisation performance.

§Compressor support

This WASM build supports lz4, szip (pure-Rust), and zstd (pure-Rust). Attempts to decode blosc2/zfp/sz3 compressed data will return an error.

Structs§

DecodedMessage
Handle to a decoded Tensogram message.
StreamingDecoder
Frame-by-frame streaming decoder.
StreamingEncoder
Streaming encoder with a selectable sink: in-memory buffer (default) or caller-supplied JS callback.

Functions§

compute_hash
Compute the hex-encoded hash of a byte slice.
decode
Decode all objects from a complete Tensogram message.
decode_metadata
Decode only the global metadata from a message (no payload decoding).
decode_object
Decode a single object by index.
decode_object_from_frame
Decode a single data-object frame’s full bytes to a DecodedMessage that owns one decoded object.
decode_range
Decode partial sub-tensor ranges from a single data object.
decode_range_from_frame
Extract ranges from a single data-object frame.
doctor
Collect environment diagnostics: build metadata, compiled-in feature states, and core encode/decode self-test results.
encode
Encode objects into a Tensogram message.
encode_pre_encoded
Encode a complete Tensogram message from pre-encoded data objects.
parse_backward_postamble_outcome
Parse a backward-postamble fetch and return its outcome.
parse_descriptor_cbor
Decode a DataObjectDescriptor from its raw CBOR bytes.
parse_footer_chunk
Parse footer metadata + index from a chunk that covers the footer region — i.e. [first_footer_offset, message_end - POSTAMBLE_SIZE).
parse_forward_preamble_outcome
Parse a forward-preamble fetch and return its outcome.
parse_header_chunk
Parse header metadata + index from a chunk that starts at message offset 0 (the preamble). Stops at the first data-object or preceder frame. Returns nulls for frames that fall outside the supplied chunk so TS can decide to widen its Range fetch.
read_data_object_frame_footer
Parse the 20-byte footer of a data-object frame (type NTensorFrame).
read_data_object_frame_header
Parse the 16-byte header of a data-object frame.
read_postamble_info
Inspect a wire-format postamble.
read_preamble_info
Inspect a wire-format preamble.
same_message_check
true iff a forward Hit and a backward-validated layout describe the same message — used by the dispatch table to detect the 1-message file and odd-count meet-in-the-middle cases.
scan
Scan a buffer for concatenated Tensogram messages.
simple_packing_compute_params
Compute the simple-packing parameters (reference value, binary/decimal scale factors, bits-per-value) for a float64 array.
validate_backward_preamble_outcome
Validate a backward candidate preamble and return the commit decision.
validate_buffer
Validate a single Tensogram message buffer. Returns a JSON string matching the structure emitted by tensogram::validate::ValidationReport: { issues: [...], object_count: N, hash_verified: bool }.