@multiformats/multiaddr
    Preparing search index...

    Interface ProtocolCodec

    interface ProtocolCodec {
        aliases?: string[];
        code: number;
        name: string;
        size?: number;
        bytesToValue?(bytes: Uint8Array): string;
        stringToValue?(value: string): string;
        validate?(value: string): void;
        valueToBytes?(value: string): Uint8Array;
        valueToString?(value: string): string;
    }
    Index

    Properties

    aliases?: string[]

    If specified this protocol codec will also be used to decode tuples with these names from string multiaddrs.

    code: number

    A numeric code that will be used in the binary representation of the tuple.

    name: string

    A string name that will be used in the string representation of the addr.

    size?: number

    Size defines the expected length of the address part of the tuple - valid values are -1 (or the V constant) for variable length (this will be varint encoded in the binary representation), 0 for no address part or a number that represents a fixed-length address.

    Methods

    • To decode bytes to a multiaddr, convert the value bytes to a string

      Parameters

      Returns string

    • Where the multiaddr has been encoded as a string, decode the value if necessary, unescaping any escaped values

      Parameters

      • value: string

      Returns string

    • Perform any necessary validation on the string value

      Parameters

      • value: string

      Returns void

    • To encode the multiaddr as a string, escape any necessary values

      Parameters

      • value: string

      Returns string