tmeasday / meteor-router

MIT License
366 stars 76 forks source link

download image #126

Closed tinchoz49 closed 11 years ago

tinchoz49 commented 11 years ago

I want to create a download image function like this:

(express version)

app.get('/image.jpeg', function(req, res){ var file = __dirname + '/upload-folder/image.jpeg'; res.download(file); // Set disposition and send it. });

How i can make this using meteor-router?

Thanks, great package!!

tmeasday commented 11 years ago

Hi, you might want to consider migrating to Iron Router soon: https://github.com/eventedMind/meteor-iron-router/

In the meantime, you can do something like:

Meteor.Router.add({
  '/image.jpeg': function(req, res) {
    ... do whatever
  }
})

You'll need to put that in a server-side file.

I've never used res.download() before--that may just work out of the box (?)