Skip to content

Instantly share code, notes, and snippets.

@FLYBYME
Created November 22, 2010 21:11
Show Gist options
  • Save FLYBYME/710690 to your computer and use it in GitHub Desktop.
Save FLYBYME/710690 to your computer and use it in GitHub Desktop.
var file = '';
var stream = fs.createReadStream('/home/session/A0FFCFFC63DA8D1040586132C7422CA41C29AA4C.torrent');
//stream.setEncoding('UTF-8');
stream.on('data', function(data){
file += data;
});
stream.on('close', function(data){
sys.log('File read length: '.grey + file.length);
var stuff = bencode.decode(file.toString())
//console.log(sys.inspect(stuff));
response.writeHead(200)
response.write(sys.inspect(stuff, true, 6));
response.end()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment