Created
April 3, 2012 08:06
-
-
Save sugyan/2290368 to your computer and use it in GitHub Desktop.
play codestre.am video on your terminal
This file contains 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 sio = require('socket.io-client'); | |
var socket = sio.connect('http://play.codestre.am/?id=' + '3Y'); | |
console.log('connecting...'); | |
socket.on('connect', function () { | |
console.log('connected.'); | |
}); | |
socket.on("frames", function (frames) { | |
process.stdout.write("\x1b[2J\x1b[1;1H"); | |
var loop = function () { | |
if (frames.length === 0) { | |
process.exit(0); | |
} | |
var obj = frames.shift(); | |
setTimeout(function () { | |
process.stdout.write(obj.data); | |
loop(); | |
}, obj.delta); | |
}; | |
loop(); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment