This package has been deprecated

Author message:

Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.

orbit-db-feedstore

2.0.0 • Public • Published

orbit-db-feedstore

npm version Gitter Matrix Discord

Log database for orbit-db

A log database with traversable history. Entries can be added and removed. Useful for "shopping cart" type of use cases, or for example as a feed of blog posts or "tweets".

Used in orbit-db.

Table of Contents

Install

This project uses npm and node

npm install orbit-db ipfs

Usage

First, create an instance of OrbitDB:

import * as IPFS from 'ipfs'
import OrbitDB from 'orbit-db'

const ipfs = new IPFS()
const orbitdb = await OrbitDB.createInstance(ipfs)

Get a feed database and add an entry to it:

const feed = await orbitdb.feed('haad.posts')
feed.add({ title: 'Hello', content: 'World' })
  .then(() => {
    const posts = feed.iterator().collect()
    posts.forEach((post) => {
      let data = post.payload.value
      console.log(data.title + '\n', data.content)
      // Hello
      //  World   
    })
  })

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

const feed = await orbitdb.feed('haad.posts')
feed.events.on('ready', () => {
  const posts = feed.iterator().collect()
  posts.forEach((post) => console.log(post.title + '\n', post.content))
  // Hello
  // World  
})

API

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

Contributing

If you think this could be better, please open an issue!

Please note that all interactions in @orbitdb fall under our Code of Conduct.

Note: Tests for this repo are in the orbit-db repository.

License

MIT © 2016-2020 Protocol Labs Inc., Haja Networks Oy

Package Sidebar

Install

npm i orbit-db-feedstore

Weekly Downloads

459

Version

2.0.0

License

MIT

Unpacked Size

10.6 kB

Total Files

9

Last publish

Collaborators

  • haad
  • hajamark
  • shamb0t