IPFS Block JavaScript Implementation
IPFS implementation of the Block data structure in JavaScript.
Block - A block is a blob of binary data.
Lead Maintainer
Table of Contents
Install
npm
> npm install ipfs-block
Usage
Node.js
const Block =
Example
const Block = // create a blockconst block = 'hello world' cidconsole
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 =
<script>
Tag
Browser: Loading this module through a script tag will make the IpfsBlock
obj available in
the global namespace.
<!-- OR -->
API
const 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.