Serve a file outside servers public scope to client with node.js
I've some files placed inside an upload folder which is not accessible
without privileges and is outside from servers public scope. If the owner
want to download the previously uploaded file I need to pipe the file.
That for I thought Streaming is the right way but I can't get it work. So
my actually working solution is the following example. Is this still
correct?
APP.fs.readFile(media.path, function(error, file) {
if (error === null) {
res.type(media.type);
res.send(file);
} else {
self.Component.send404(res);
}
});
No comments:
Post a Comment