1app.get('/download', function(req, res, next) {
2 // Get the download sid
3 var downloadSid = req.query.sid;
4
5 // Get the download file path
6 getDownloadFilePath(downloadSid, function(err, path) {
7 if (err) return res.end('Error');
8
9 // Read and send the file here...
10
11 // Finally, delete the download session to invalidate the link
12 deleteDownload(downloadSid, function(err) {
13 // ...
14 });
15 });
16});