Intro
Installable via npm install --save ipfs-block
, 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 ipfs-block
You can then require()
ipfs-block as normal:
const ipfsBlock = require('ipfs-block')
In the Browser
Ipfs-block should work in any ES2015 environment out of the box.
Usage:
<script type="text/javascript" src="index.js"></script>
The portable versions of ipfs-block, including index.js
and index.min.js
, are included in the /dist
folder. Ipfs-block can also be found on unpkg.com under
Block
Represents an immutable block of data that is uniquely referenced with a cid.
Parameters
data: Buffer
:The data to be stored in the block as a buffer.cid: CID
:The cid of the data
Example
const block = new Block(new Buffer('a012d83b20f9371...'))