Utility class for creating CIDs. Exported for the convenience of developers.

Constructors

Methods

  • Computes a V1 CID for the provided payload

    Parameters

    • payload: any
    • codecCode: number = cbor.code

      the codec to use. Defaults to cbor

    • multihashCode: number = sha256.code

      the multihasher to use. Defaults to sha256

    Returns Promise<string>

    payload CID

    Throws

    codec is not supported

    Throws

    encoding fails

    Throws

    if hasher is not supported

  • Parameters

    • content: Uint8Array

    Returns Promise<string>

    V1 CID of the DAG comprised by chunking data into unixfs DAG-PB encoded blocks

  • Parameters

    • dataStream: Readable

    Returns Promise<string>

    V1 CID of the DAG comprised by chunking data into unixfs DAG-PB encoded blocks

  • Parses the given CID string into a {CID}.

    Parameters

    • str: string

    Returns CID<unknown, number, number, Version>