SerializedCID

src/index.js
SerializedCID

Type: Object

Parameters
codec (string)
version (number)
multihash (Uint8Array)

The CID as a Uint8Array

bytes
Returns
Uint8Array:

Get the prefix of the CID.

prefix
Returns
Uint8Array:

Convert to a CID of version 0.

toV0(): CID
Returns
CID:

Convert to a CID of version 1.

toV1(): CID
Returns
CID:

toBaseEncodedString

src/index.js

Encode the CID into a string.

toBaseEncodedString(base: string): string
Parameters
base (string = this.multibaseName) Base encoding to use.
Returns
string:

CID(QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n)

toString(): String
Returns
String:

Serialize to a plain object.

toJSON(): SerializedCID
Returns
SerializedCID:

Compare equality with another CID.

equals(other: CID): bool
Parameters
other (CID)
Returns
bool:

validateCID

src/index.js

Test if the given input is a valid CID object. Throws if it is not.

validateCID(other: any): void
Parameters
other (any)
Returns
void:

Class representing a CID <mbase><version><mcodec><mhash> , as defined in ipld/cid.

new CID()
Static Members
isCID(other)
Instance Members
version
codec
multihash
multibaseName

checkCIDComponents

src/cid-util.js

Test if the given input is a valid CID object. Returns an error message if it is not. Returns undefined if it is a valid CID.

checkCIDComponents(other: any): string
Parameters
other (any)
Returns
string: