I am try download a file from Amazon S3 with express.js and request.js using the pipe method.
But when I go to: localhost:3000/download the browser download a file with the name of "download" How I can Set the file name for the browser to download such as "myFile.zip"?
This is my code:
var express = require('express');
var app = express();
var request = require('request');
app.get('/download', function(req, res){
request('https://s3-us-west-2.amazonaws.com/bucket-name/object.zip')
.pipe(res.set('Content-Type', 'application/zip'))
});
app.listen(3000);
Any help is going to be appreciated !