UNPKG

telehash

Version:

A telehash library for node and browserify

27 lines (24 loc) 762 B
'use strict'; var telehash = require("./../../index.js") var fs = require("fs") telehash.load({id : "./hashright.hn"}, (er, mesh) => { mesh.accept = (from) => { console.log("got accept ", from.hashname); mesh.link(from, () => { console.log("got link status", from.hashname) }) } let mid = mesh.link(JSON.parse(fs.readFileSync("./hashmiddle.json").toString()), () => { console.log("link middle") let left = JSON.parse(fs.readFileSync("./hashleft.json").toString()); left.paths = [{ type : "peer", hn : mid.hashname }] console.log("attempt link peer") let LLL = mesh.link(left, () => { console.log("LEFT PEERED : )") LLL.stream().pipe(fs.createWriteStream("./receive.txt")) }) }) })