### cids

`0.8.0`
Need help reading this?

## Intro

Installable via `npm install --save cids`, it can also be used directly in the browser.

## Download

The source is available for download from GitHub. Alternatively, you can install using npm:

    $ npm install --save cids

You can then `require()` cids as normal:

    const cids = require('cids')

## In the Browser

Cids should work in any ES2015 environment out of the box.

Usage:

    <script type="text/javascript" src="index.js"></script>

The portable versions of cids, including `index.js` and `index.min.js`, are included in the `/dist` folder. Cids can also be found on unpkg.com under

- https://unpkg.com/cids/dist/index.min.js
- https://unpkg.com/cids/dist/index.js

### SerializedCID

src/index.js
SerializedCID

Type: Object

Parameters
codec `(string)`
version `(number)`
multihash `(Buffer)`

### buffer

src/index.js

The CID as a `Buffer`

buffer
Returns
`Buffer`:

### prefix

src/index.js

Get the prefix of the CID.

prefix
Returns
`Buffer`:

### toV0

src/index.js

Convert to a CID of version `0`.

toV0(): CID
Returns
`CID`:

### toV1

src/index.js

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`:

### toString

src/index.js

CID(QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n)

toString(): String
Returns
`String`:

### toJSON

src/index.js

Serialize to a plain object.

toJSON(): SerializedCID
Returns
`SerializedCID`:

### equals

src/index.js

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`:

### CID

src/index.js

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

new CID()
Static Members
▸ isCID(other)
src/index.js

Test if the given input is a CID.

isCID(other: any): bool
Parameters
other `(any)`
Returns
`bool`:
Instance Members
▸ version
src/index.js
version

Type: number

▸ codec
src/index.js
codec

Type: string

▸ multihash
src/index.js
multihash

Type: Buffer

▸ multibaseName
src/index.js
multibaseName

Type: string

### 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`: