0.7.5
Installable via npm install --save cids
, it can also be used directly in the browser.
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')
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
Type: Object
The CID as a Buffer
Buffer
:
Get the prefix of the CID.
Buffer
:
Convert to a CID of version 0
.
CID
:
Convert to a CID of version 1
.
CID
:
Encode the CID into a string.
(string
= this.multibaseName
)
Base encoding to use.
string
:
CID(QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n)
String
:
Serialize to a plain object.
SerializedCID
:
Compare equality with another CID.
(CID)
bool
:
Test if the given input is a valid CID object. Throws if it is not.
(any)
void
:
Class representing a CID <mbase><version><mcodec><mhash>
, as defined in ipld/cid.
Test if the given input is a CID.
(any)
bool
:
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.
(any)
string
: