Skip to content

Instantly share code, notes, and snippets.

@hackergrrl
Created October 31, 2019 21:25
Show Gist options
  • Save hackergrrl/f75adb28637cb0c365dc566ecb23224d to your computer and use it in GitHub Desktop.
Save hackergrrl/f75adb28637cb0c365dc566ecb23224d to your computer and use it in GitHub Desktop.
// example of using 'hypercore-sync-partial-feeds' module
var Sync = require('hypercore-sync-partial-feeds')
var Corestore = require('corestorage')
var cores1 = new Corestore(ram)
var cores2 = new Corestore(ram)
// TODO: populate cores
var r1 = Sync(cores1, holdFn, rejectFn)
var r2 = Sync(cores2, holdFn, rejectFn)
r1.pipe(r2).pipe(r1)
// decides whether to share a local feed to the remote
function holdFn (feed, next) {
// ...
}
// decides whether to accept a remote feed to local
function rejectFn (feed, next) {
// ...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment