Skip to content

Instantly share code, notes, and snippets.

@yhsiang
Created June 27, 2013 01:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save yhsiang/5873260 to your computer and use it in GitHub Desktop.
Save yhsiang/5873260 to your computer and use it in GitHub Desktop.
Meteor.Router.add('/test', 'GET', function () {
var path = Npm.require('path');
var fs = Npm.require('fs');
var file = '/Users/yhsiang/Work/meteor_apps/databank/public/1235.JPG';
var filename = path.basename(file);
return [200,
{
'Content-type': 'image/jpeg',
'Content-disposition': "attachment; filename="+filename
},fs.readFileSync(file)
];
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment