Last active
July 26, 2016 23:01
-
-
Save mafintosh/6708a026a88d1e94ee33540eff23f954 to your computer and use it in GitHub Desktop.
dat stats demo that plays sintel.mp4
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
var swarm = require('hyperdrive-archive-swarm') | |
var hyperdrive = require('hyperdrive') | |
var stats = require('hypercore-stats-ui') | |
var http = require('http') | |
var memdb = require('memdb') | |
var serve = require('hyperdrive-http') | |
var drive = hyperdrive(memdb()) | |
// a remote dat | |
var archive = drive.createArchive('2d8186c581cd9c1b4f45e42eb765cebcba983feb8a0525d7bffee1ce3b7a9471') | |
http.createServer(stats(archive)).listen(10000) // stats ui hosted at http://localhost:10000 | |
http.createServer(serve(archive)).listen(8000) // file hosted at http://localhost:8000/sintel.mp4 | |
swarm(archive) |
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
{ | |
"name": "stats-demo", | |
"version": "1.0.0", | |
"description": "dat stats demo", | |
"main": "index.js", | |
"dependencies": { | |
"hypercore-stats-ui": "^1.1.0", | |
"hyperdrive": "^6.6.0", | |
"hyperdrive-archive-swarm": "^3.1.0", | |
"hyperdrive-http": "^3.0.0", | |
"memdb": "^1.3.1" | |
}, | |
"devDependencies": {}, | |
"author": "Mathias Buus" | |
} |
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
# open a terminal | |
git clone https://gist.github.com/mafintosh/6708a026a88d1e94ee33540eff23f954 stats-demo | |
cd stats-demo | |
npm install | |
node index.js # and go to http://localhost:10000 and http://localhost:8000/sintel.mp4 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment