Skip to content

Latest commit

 

History

History
94 lines (66 loc) · 3.57 KB

README.md

File metadata and controls

94 lines (66 loc) · 3.57 KB

js-cid

Coverage Status Travis CI Circle CI Dependency Status js-standard-style

CID implementation in JavaScript.

Table of Contents

Install

In Node.js through npm

$ npm install --save cids

Browser: Browserify, Webpack, other bundlers

The code published to npm that gets loaded on require is in fact an ES5 transpiled version with the right shims added. This means that you can require it and use with your favourite bundler without having to adjust asset management process.

const CID = require('cids')

In the Browser through <script> tag

Loading this module through a script tag will make the Cids obj available in the global namespace.

<script src="https://unpkg.com/cids/dist/index.min.js"></script>
<!-- OR -->
<script src="https://unpkg.com/cids/dist/index.js"></script>

Gotchas

You will need to use Node.js Buffer API compatible, if you are running inside the browser, you can access it by multihash.Buffer or you can install Feross's Buffer.

Usage

const CID = require('cids')

// V1 CID
const cid = new CID(1, 'dag-pb', multihash)

// V0 CID
const cid = new CID(base58Multihash)

API

See https://ipld.github.io/js-cid

Contribute

Contributions welcome. Please check out the issues.

Check out our contributing document for more information on how we work, and about contributing in general. Please be aware that all interactions related to multiformats are subject to the IPFS Code of Conduct.

Small note: If editing the Readme, please conform to the standard-readme specification.

License

MIT