ipfs-block-service

JavaScript Implementation of BlockService

This module has been merged into ipfs
Last updated 5 years ago by achingbrain .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install ipfs-block-service 
SYNC missed versions from official npm registry.

⛔️ DEPRECATED: This module has been merged into ipfs

IPFS Block Service

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

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│
└─────────┘ └───────┘

Lead Maintainer

Volker Mische

Table of Contents

Install

npm

> npm install ipfs-block-service

Usage

Node.js

const BlockService = require('ipfs-block-service')

Example

const BlockService = require('ipfs-block-service')
const Block = require('ipld-block')
const multihashing = require('multihashing-async')
const IPFSRepo = require('ipfs-repo')  // storage repo
const uint8ArrayEquals = require('uint8arrays/equals')
const uint8ArrayFromString = require('uint8arrays/from-string')

// setup a repo
const repo = new IPFSRepo('example')

// create a block
const data = uint8ArrayFromString('hello world')
const multihash = await multihashing(data, 'sha2-256')

const cid = new CID(multihash)
const block = new Block(data, cid)

// create a service
const service = new BlockService(repo)

// add the block, then retrieve it
await service.put(block)

const result = await service.get(cid)
console.log(uint8ArrayEquals(block.data, result.data))
// => true

Browser: Browserify, Webpack, other bundlers

var BlockService = require('ipfs-block-service')

Browser: <script> Tag

Loading 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>

API

See https://ipfs.github.io/js-ipfs-block-service

Contribute

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

This repository falls under the IPFS Code of Conduct.

License

MIT

Current Tags

  • 0.19.1                                ...           latest (5 years ago)

29 Versions

  • 0.19.1 [deprecated]           ...           5 years ago
  • 0.19.0 [deprecated]           ...           5 years ago
  • 0.18.0 [deprecated]           ...           6 years ago
  • 0.17.1 [deprecated]           ...           6 years ago
  • 0.17.0 [deprecated]           ...           6 years ago
  • 0.16.0 [deprecated]           ...           7 years ago
  • 0.15.2 [deprecated]           ...           7 years ago
  • 0.15.1 [deprecated]           ...           7 years ago
  • 0.15.0 [deprecated]           ...           7 years ago
  • 0.14.0 [deprecated]           ...           8 years ago
  • 0.13.0 [deprecated]           ...           8 years ago
  • 0.12.0 [deprecated]           ...           9 years ago
  • 0.10.0 [deprecated]           ...           9 years ago
  • 0.9.1 [deprecated]           ...           9 years ago
  • 0.9.0 [deprecated]           ...           9 years ago
  • 0.8.3 [deprecated]           ...           9 years ago
  • 0.8.2 [deprecated]           ...           9 years ago
  • 0.8.1 [deprecated]           ...           9 years ago
  • 0.8.0 [deprecated]           ...           9 years ago
  • 0.7.2 [deprecated]           ...           9 years ago
  • 0.7.1 [deprecated]           ...           9 years ago
  • 0.7.0 [deprecated]           ...           9 years ago
  • 0.6.0 [deprecated]           ...           9 years ago
  • 0.5.0 [deprecated]           ...           10 years ago
  • 0.4.0 [deprecated]           ...           10 years ago
  • 0.3.0 [deprecated]           ...           10 years ago
  • 0.2.8 [deprecated]           ...           10 years ago
  • 0.2.5 [deprecated]           ...           10 years ago
  • 0.2.4 [deprecated]           ...           10 years ago
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (2)
Dev Dependencies (17)

Copyright 2013 - present © cnpmjs.org | Home |