sailsjs send a file on the fly with res.attachment()
问题 I would like to send a file to a client using something like res.attachment() in sailsjs. I do not want to store the file on the server at all, I simply want to generate it constantly and send it to the client. For example, my controller looks like this file: function(req, res, next) { var name = req.param('name'); var data = 'Welcome Mr/Mrs ' + name res.attachment(data, 'fileName.txt') res.send() }, Couple of problems 1) res.attachment does not seem to accept a file name as a parameter 2)