Created
October 31, 2019 21:25
-
-
Save hackergrrl/f75adb28637cb0c365dc566ecb23224d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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