Skip to content
/ js-cid Public
forked from multiformats/js-cid

CID implementation in JavaScript

License

Notifications You must be signed in to change notification settings

mikeal/js-cid

 
 

Repository files navigation

js-cid

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

CID implementation in JavaScript.

Lead Maintainer

Volker Mische

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

About

CID implementation in JavaScript

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 99.0%
  • Groovy 1.0%