Q:

How to preserve filename when piping an s3 file download using pkgcloud and express

I'm using an express server to proxy a file to download from amazon s3.  How do I either preserve the filename in the header or set the filename info in the headers so that when a user downloads the filename it doesn't just say s3.jpeg but instead correctly says test.jpg?
 app.get("/s3", function(req, res) {
    var client;

    client = require('pkgcloud').storage.createClient({
      provider: "amazon",
      key: "test",
      keyId: "test"
    });
    return client.download({
      container: 'test',
      remote: 'test.jpg'
    }).pipe(res);
  });

A:

Ok, seems easy enough
res.setHeader('Content-disposition', 'attachment; filename=test.jpg');
in coffeescript
app.get "/s3", (req, res) ->

    res.setHeader('Content-disposition', 'attachment; filename=test.jpg');

    client.download(
        container:'test'
        remote:'test.jpg'
    ).pipe res

