structom

structom javascript library

the official package for working with structom for the javascript language

structom

structom (StructuredAtoms) is a lightweight general data exchange format designed for universal applications, from small human readable object files to large scale data serialization.

structom has 3 different forms for data representation:

structom provide additional rich data structures (tagged unions), supports both schema and schemaless data, and provide support for user defined erased metadata for richer data representation.

structom is designed to be very versatile and expressive, while remaining efficient and performant, adapting for any need from high level rich data notation to low level effecient serialization.

read more about the structom format in its specification.

Value

export interface UUID {
	type: 'uuid',
	value: Uint8Array
};
export interface Dur {
	type: 'dur',
	value: bigint
}
export type Value = 
	boolean | number | string | bigint | Date | UUID | Dur | Array<Value> | Map<Value, Value>;

Value: a structom value, can be:

encode / decode

export function encode(value: Value): Uint8Array;
export function decode(data: ArrayBuffer): Value;

encode: encode a given Value into its binary representation.
decode: decode a given binary data into a Value.

this functions expect / insert a header before the encoded data, specifing any type.

codegen support

this package also export a collection of encoding and decoding utilities used by the generated serialization code, not intended to be used directly.