scuttlebot plugin for indexing all link mentions of messages
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.github
.gitignore
.npmrc
README.md
emit-links.js
index.js
package.json

README.md

ssb-backlinks

scuttlebot plugin for indexing all link mentions of messages (including private for the current identity).

Walks all values of a message searching for ssb-ref recognized keys. Provides an ssb-query style interface.

Example usage

const pull = require('pull-stream')
function createBacklinkStream (id) {
  var filterQuery = {
    $filter: {
      dest: id
    }
  }

  return sbot.backlinks.read({
    query: [filterQuery],
    index: 'DTA', // use asserted timestamps
    live: true
  })
}

const msgKey = '%+zYA9WF9cY+HqGLzqS1H7FdUdK45tUmTqiZ85p+RNOQ=.sha256'
var relatedMessages = []

pull(
  createBacklinkStream(msgKey),
  pull.filter(msg => !msg.sync),
    // note the 'live' style streams emit { sync: true } when they're up to date!
  pull.drain(msg => {
    relatedMessages.push(msg)
  })
)

Versions

Please note that 0.7.0 requires scuttlebot 11.3

License

MIT