Last active
November 8, 2015 13:57
-
-
Save shime/cc4b9d5737b9ada9baf8 to your computer and use it in GitHub Desktop.
Revisions
-
shime renamed this gist
Nov 8, 2015 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
shime created this gist
Nov 8, 2015 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,2 @@ node_modules *.log 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,8 @@ # Hello world over Bittorrent DHT git clone [email protected]:8af1e7887515133208af.git hello-world cd hello-world npm install npm start  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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,17 @@ var DHT = require('bittorrent-dht') var dht = new DHT() var value = new Buffer(11).fill('hello world') console.log('putting data, please wait...') dht.on('ready', function () { dht.put({ v: value }, function (errors, hash) { console.error('errors=', errors) console.log('hash=', hash) console.log('getting data, please wait...') dht.get(hash, function(errors, res){ console.error('errors=', errors) console.log(res.v.toString()) }) }) }) 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,15 @@ { "name": "bittorrent-example", "version": "1.0.0", "description": "", "main": "index.js", "scripts": { "start": "node hello.js" }, "keywords": [], "author": "", "license": "ISC", "dependencies": { "bittorrent-dht": "^4.0.3" } }