A11 TypeScript API - v0.7.0
    Preparing search index...

    Interface SerializationCodec<T>

    Bidirectional application-value codec registered at the node boundary. tag is stable across languages and is written into the MIME type parameter so a remote peer can select the matching decoder.

    interface SerializationCodec<T = unknown> {
        deserialize: (
            data: Uint8Array,
            chunk: Chunk,
        ) => StatusOr<T> | Promise<StatusOr<T>>;
        mimetype: string;
        serialize: (
            value: T,
        ) => StatusOr<SerializedData> | Promise<StatusOr<SerializedData>>;
        tag: string;
        test: (value: unknown) => value is T;
    }

    Type Parameters

    • T = unknown
    Index
    deserialize: (
        data: Uint8Array,
        chunk: Chunk,
    ) => StatusOr<T> | Promise<StatusOr<T>>

    Decode owned payload bytes.

    mimetype: string

    Exact media type or wildcard representation pattern.

    serialize: (
        value: T,
    ) => StatusOr<SerializedData> | Promise<StatusOr<SerializedData>>

    Encode one accepted value.

    tag: string

    Stable, cross-language value tag written as the MIME type parameter.

    test: (value: unknown) => value is T

    Whether this codec accepts a value for serialization.