add filesystem support(without frontend)

This commit is contained in:
hzsunshx
2015-09-17 16:52:17 +08:00
parent 7188ca8f2a
commit b258837757
6 changed files with 174 additions and 0 deletions

View File

@@ -138,6 +138,10 @@ module.exports = function(options) {
app.get('/s/blob/:id/:name', function(req, res) {
var file = storage.retrieve(req.params.id)
if (file) {
if (typeof req.query.download !== 'undefined') {
res.set('Content-Disposition',
'attachment; filename="' + path.basename(file.name) + '"')
}
res.set('Content-Type', file.type)
res.sendFile(file.path)
}