Product
Introducing Enhanced Alert Actions and Triage Functionality
Socket now supports four distinct alert actions instead of the previous two, and alert triaging allows users to override the actions taken for all individual alerts.
ipfs-block-service
Advanced tools
Readme
IPFS implementation of the BlockService and Block data structure in JavaScript.
BlockService - A BlockService is a content-addressable store for blocks, providing an API for adding, deleting, and retrieving blocks. A BlockService is backed by an IPFS Repo as its datastore for blocks, and uses Bitswap to fetch blocks from the network.
┌───────────────────┐
│ BlockService │
└───────────────────┘
┌─────┴─────┐
▼ ▼
┌─────────┐ ┌───────┐
│IPFS Repo│ |Bitswap│
└─────────┘ └───────┘
> npm install ipfs-block-service
const BlockService = require('ipfs-block-service')
const BlockService = require('ipfs-block-service')
const Block = require('ipfs-block')
const multihashing = require('multihashing-async')
const IPFSRepo = require('ipfs-repo') // storage repo
// setup a repo
const repo = new IPFSRepo('example')
// create a block
const data = new Buffer('hello world')
multihashing(data, 'sha2-256', (err, multihash) => {
if (err) {
throw err
}
const cid = new CID(multihash)
const block = new Block(data, cid)
// create a service
const bs = new BlockService(repo)
// add the block, then retrieve it
bs.put(block, (err) => {
if (err) {
throw err
}
bs.get(cid, (err, b) => {
if (err) {
throw err
}
console.log(block.data.toString() === b.data.toString())
// => true
})
})
})
var BlockService = require('ipfs-block-service')
<script>
TagLoading this module through a script tag will make the IpfsBlockService
obj available in
the global namespace.
<script src="https://unpkg.com/ipfs-block-service/dist/index.min.js"></script>
<!-- OR -->
<script src="https://unpkg.com/ipfs-block-service/dist/index.js"></script>
See https://ipfs.github.io/js-ipfs-block-service
Feel free to join in. All welcome. Open an issue!
This repository falls under the IPFS Code of Conduct.
FAQs
JavaScript Implementation of BlockService
The npm package ipfs-block-service receives a total of 651 weekly downloads. As such, ipfs-block-service popularity was classified as not popular.
We found that ipfs-block-service demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 3 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Socket now supports four distinct alert actions instead of the previous two, and alert triaging allows users to override the actions taken for all individual alerts.
Security News
Polyfill.io has been serving malware for months via its CDN, after the project's open source maintainer sold the service to a company based in China.
Security News
OpenSSF is warning open source maintainers to stay vigilant against reputation farming on GitHub, where users artificially inflate their status by manipulating interactions on closed issues and PRs.