6.0.1 • Published 6 years ago

hypercore-index v6.0.1

Weekly downloads
3
License
MIT
Repository
github
Last release
6 years ago

hypercore-index

Linear asynchronous stateful indexing of a hypercore feed.

build status Greenkeeper badge

Traverses a hypercore feed in chronologic order and lets you consume each entry via some asynchronous function. Remembers where you left inside the feed's db and continues there on later runs.

Example

const ram = require('random-access-memory')
const hypercore = require('hypercore')
const index = require('hypercore-index')

const feed = hypercore(ram)

index(ram(), {
  feed: feed
}, function onentry (entry, next) {
  console.log('entry', entry.toString())
  next()
}, function ondone (err) {
  if (err) throw err
  console.log('Done!')
})

Installation

$ npm install hypercore-index

API

var append = index(storage, opts, onentry, ondone)

storage is an abstract-random-access compliant storage or file path.

Options:

  • feed: The hypercore feed. Required.
  • start: The first index. Default: 0
  • end: The last index. Default: Infinity
  • live: Whether to keep scanning. Default: true, unless you pass opts.end

If you are the feed owner you can use the append(data, callback) method returned to append data and and wait for it to be indexed

License

MIT

6.0.1

6 years ago

6.0.0

7 years ago

5.1.1

7 years ago

5.1.0

7 years ago

5.0.0

8 years ago

4.0.0

8 years ago

3.0.2

8 years ago

3.0.1

8 years ago

3.0.0

8 years ago

2.0.0

8 years ago

1.0.1

8 years ago

1.0.0

8 years ago