New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

orbit-db-eventstore

Package Overview
Dependencies
Maintainers
1
Versions
56
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

orbit-db-eventstore

Eventlog for orbit-db

1.1.2
Source
npm
Version published
Weekly downloads
868
27.09%
Maintainers
1
Weekly downloads
 
Created
Source

orbit-db-eventstore

npm version

An append-only log with traversable history. Useful for "latest N" use cases or as a message queue.

Used in orbit-db.

Table of Contents

Install

npm install orbit-db ipfs

Usage

First, create an instance of OrbitDB:

const IPFS = require('ipfs')
const OrbitDB = require('orbit-db')

const ipfs = new IPFS()
const orbitdb = new OrbitDB(ipfs)

Get a log database and add an entry to it:

const log = orbitdb.eventlog('haad.posts')
log.add({ name: 'hello world' })
  .then(() => {
    const items = log.iterator().collect()
    items.forEach((e) => console.log(e.name))
    // "hello world"
  })

Later, when the database contains data, load the history and query when ready:

const log = orbitdb.eventlog('haad.posts')
log.events.on('ready', () => {
  const items = log.iterator().collect()
  items.forEach((e) => console.log(e.name))
  // "hello world"
})

See example/index.html for a detailed example. Note that to run this example, you need to have a local IPFS daemon running at port 5001.

API

See orbit-db's API Documenations for full details.

Contributing

See orbit-db's contributing guideline.

License

MIT ©️ 2016 Haadcode

FAQs

Package last updated on 14 Dec 2017

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