Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
play codestre.am video on your terminal
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