Blockchain Commons Uniform Resources TypeScript Library - v1.0.0-alpha.13
    Preparing search index...

    Class MultipartDecoder

    Decodes multiple UR parts back into a single UR.

    This reassembles multipart URs that were encoded using fountain codes. The decoder can handle out-of-order reception and packet loss.

    const decoder = new MultipartDecoder();

    for (const urPart of urParts) {
    decoder.receive(urPart);
    if (decoder.isComplete()) {
    const ur = decoder.message();
    break;
    }
    }
    Index

    Constructors

    Methods

    • Receives a UR part string.

      Parameters

      • part: string

        A UR part string (e.g., "ur:bytes/1-10/..." or "ur:bytes/...")

      Returns void

      If the part doesn't start with "ur:"

      If the type doesn't match previous parts

    • Gets the decoded UR message.

      Returns UR | null

      The decoded UR, or null if not yet complete