ipfs-block

0.8.1 • Public • Published

IPFS Block JavaScript Implementation

standard-readme compliant Travis CI Coverage Status Dependency Status js-standard-style

IPFS implementation of the Block data structure in JavaScript.

Block - A block is a blob of binary data.

Lead Maintainer

Volker Mische

Table of Contents

Install

npm

> npm install ipfs-block

Usage

Node.js

const Block = require('ipfs-block')

Example

const Block = require('ipfs-block')
 
// create a block
const block = new Block(new Buffer('hello world'), cid)
console.log(block.data.toString())

Browser: Browserify, Webpack, other bundlers

The code published to npm that gets loaded on require is in fact a 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 Block = require('ipfs-block')

Browser: <script> Tag

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

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

API

const Block = require('ipfs-block')

Block

new Block(data, cid)

  • data: Buffer

Creates a new block with raw data data.

block.data

The raw data of the block. Its format matches whatever was provided in its constructor.

block.cid

The cid of the block.

Contribute

Feel free to join in. All welcome. Open an issue!

This repository falls under the IPFS Code of Conduct.

License

MIT

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
0.8.18,687latest

Version History

VersionDownloads (Last 7 Days)Published
0.8.18,687
0.8.036
0.7.148
0.6.128
0.6.01
0.5.57
0.5.41
0.5.31
0.5.21
0.5.11
0.5.01
0.4.01
0.3.014
0.2.21
0.2.11
0.2.01

Package Sidebar

Install

npm i ipfs-block

Weekly Downloads

8,830

Version

0.8.1

License

MIT

Unpacked Size

11.5 kB

Total Files

6

Last publish

Collaborators

  • daviddias
  • dignifiedquire
  • victorbjelkholm
  • vmx