ipfs-block
0.6.1

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 unkpkg.com under

Block

Represents an immutable block of data that is uniquely referenced with a cid.

Parameters

  1. data: Buffer:  
    The data to be stored in the block as a buffer.
  2. cid: CID:  
    The cid of the data

Example

const block = new Block(new Buffer('a012d83b20f9371...'))

static

Block.isBlock

isBlock(other: any): bool

Check if the given value is a Block.

Parameters

  1. other: any:  

Returns

bool

instance

Block.prototype.data

data: Buffer

The data of this block.

Block.prototype.cid

cid: CID

The cid of the data this block represents.