Latest Threat ResearchGlassWorm Loader Hits Open VSX via Developer Account Compromise.Details
Socket
Book a DemoInstallSign in
Socket

hypercore-index

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hypercore-index

Linear asynchronous stateful indexing of a hypercore feed

Source
npmnpm
Version
3.0.2
Version published
Weekly downloads
18
100%
Maintainers
1
Weekly downloads
 
Created
Source

hypercore-index

Linear asynchronous stateful indexing of a hypercore feed.

build status

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 hypercore = require('hypercore')
const index = require('hypercore-index')

const core = hypercore(db)
const feed = core.createFeed()

index(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

index(feed, [opts], onentry, [ondone])

Options:

  • start: The first index. Default: 0
  • end: The last index. Default: Infinity
  • key: The key under which to store the last processed index in the db. Default: feed.key
  • live: Whether to keep scanning. Default: true, unless you pass opts.end

license

MIT

FAQs

Package last updated on 28 Sep 2016

Did you know?

Socket

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.

Install

Related posts