IPLD implementation of the Block data structure in JavaScript.
Block - A block is a blob of binary data combined with a CID.
> npm install ipld-block
const Block = require('ipld-block')
const Block = require('ipld-block')
// create a block
const block = new Block(new Buffer('hello world'), cid)
console.log(block.data.toString())
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('ipld-block')
Loading this module through a script tag will make the IpldBlock
obj available in
the global namespace.
<script src="https://unpkg.com/ipld-block/dist/index.min.js"></script>
<!-- OR -->
<script src="https://unpkg.com/ipld-block/dist/index.js"></script>
const Block = require('ipld-block')
data: Buffer
Creates a new block with raw data data
.
The raw data of the block. Its format matches whatever was provided in its constructor.
The cid of the block.
Feel free to join in. All welcome. Open an issue!
This repository falls under the IPFS Code of Conduct.