hypercore-sparse-index

0.0.0 • Public • Published

WIP hypercore-sparse-index

Index blocks as they're downloaded

Note: This module is strongly limited in that it only indexes blocks on startup and as they're downloaded. Meaning it will not index new blocks as they're appended

Usage

'use strict'
 
var memdb = require('memdb')
var hypercore = require('hypercore')
var sparseIndex = require('hypercore-sparse-index')
 
var feed = hypercore(memdb()).createFeed('feed-key-from-somewhere', {sparse: true})
 
sparseIndex({
  db: memdb(),
  feed: feed
}, function (entry, next) {
  console.log(entry)
 
  next()
}, function (err) {
  console.error(err)
})
 
feed.get(0, function () {})
feed.get(1, function () {})
feed.get(2, function () {})
 

API

HypercoreSparseIndex(opts, onentry, [onerror])

{
  db, // Level instance
  feed // Hypercore feed
}

License

ISC

install

npm i hypercore-sparse-index

Downloadsweekly downloads

3

version

0.0.0

license

ISC

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
  • avatar
Report a vulnerability