UNPKG

@hpx7/delta-pack

Version:

A TypeScript code generator and runtime for binary serialization based on schemas.

13 lines (12 loc) 472 B
import { Type } from "./schema"; type DeltaPackApi<T> = { fromJson: (obj: Record<string, unknown>) => T; toJson: (obj: T) => Record<string, unknown>; encode: (obj: T) => Uint8Array; decode: (buf: Uint8Array) => T; encodeDiff: (a: T, b: T) => Uint8Array; decodeDiff: (a: T, diff: Uint8Array) => T; equals: (a: T, b: T) => boolean; }; export declare function load<T>(schema: Record<string, Type>, objectName: string): DeltaPackApi<T>; export {};