Revisions
-
eighteyes revised this gist
Aug 6, 2013 . 1 changed file with 1 addition and 1 deletion.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 @@ -3,7 +3,7 @@ var http = require('http'), path = require('path') util = require('util'); http.createServer(function(req, res) { var filePath = 'path_to_file.mp3'; var stat = fs.statSync(filePath); -
eighteyes revised this gist
Aug 6, 2013 . 1 changed file with 7 additions and 8 deletions.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 @@ -1,19 +1,18 @@ var http = require('http'), fs = require('fs'), path = require('path') util = require('util'); http.createServer(function(request, response) { var filePath = 'path_to_file.mp3'; var stat = fs.statSync(filePath); res.writeHead(200, { "Content-Type": "audio/mpeg", 'Content-Length': stat.size }); var readStream = fs.createReadStream(filePath); readStream.pipe(res); }) .listen(2000); -
dtrce revised this gist
Sep 8, 2011 . 1 changed file with 1 addition and 1 deletion.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 @@ -4,7 +4,7 @@ var http = require('http'), util = require('util'); http.createServer(function(request, response) { var filePath = 'path_to_file.mp3'; var stat = fileSystem.statSync(filePath); response.writeHead(200, { -
dtrce created this gist
Sep 8, 2011 .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,19 @@ var http = require('http'), fileSystem = require('fs'), path = require('path') util = require('util'); http.createServer(function(request, response) { var filePath = '/Users/djavia/_Eminem Cleaning Out My Closet.mp3'; var stat = fileSystem.statSync(filePath); response.writeHead(200, { 'Content-Type': 'audio/mpeg', 'Content-Length': stat.size }); var readStream = fileSystem.createReadStream(filePath); // We replaced all the event handlers with a simple call to util.pump() util.pump(readStream, response); }) .listen(2000);