-
-
Save alanhoff/1188ca75ed0cb3ffce80 to your computer and use it in GitHub Desktop.
Revisions
-
alanhoff revised this gist
Sep 17, 2014 . 1 changed file with 1 addition and 5 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 @@ -4,9 +4,5 @@ fs.exists(file, function(exists){ if(!exists) return res(Boom.notFound('Image not found')); res.file(file); }); -
alanhoff revised this gist
Sep 17, 2014 . 1 changed file with 5 additions and 6 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,13 +1,12 @@ var file = __dirname + '/../upload/'+ req.payload.code+'.jpg'; fs.exists(file, function(exists){ if(!exists) return res(Boom.notFound('Image not found')); var stream = fs.createReadStream(file); var response = new Hapi.response.Stream(stream); response.type('text/csv'); request.reply(response); }); -
alanhoff revised this gist
Sep 17, 2014 . 1 changed file with 10 additions and 6 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,9 +1,13 @@ var file = __dirname + '/../upload/'+ req.payload.code+'.jpg'; fs.exists(file, function(exists){ if(!exists) return res(Boom.notFound('Image not found')); var stream = fs.createReadStream(file); var response = new Hapi.response.Stream(stream); response.type('text/csv'); request.reply(response); }); -
alanhoff revised this gist
Sep 17, 2014 . 1 changed file with 1 addition and 13 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 @@ -4,18 +4,6 @@ if(!exists) res(Boom.notFound('Image not found')); fs.createReadStrean(file).pipe(res); }); -
thebergamo created this gist
Sep 17, 2014 .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,21 @@ var file = __dirname + '/../upload/'+ req.payload.code+'.jpg'; fs.exists(file, function(exists){ if(!exists) res(Boom.notFound('Image not found')); var fd = fs.openSync(file, 'r'); var end = new Buffer(4); fs.readSync(fd, end, 0, 4, 0); var name = new Buffer(end.readUInt32LE(0)); fs.readSync(fd, name, 0, end.readUInt32LE(0), 4); fs.closeSync(fd); fs.createReadStrean(file, { start: end.readUInt32LE(0) + 4 }).pipe(res); });