pull/12/head
tycrek 4 years ago
parent e397804c20
commit 850d6ceb21
No known key found for this signature in database
GPG Key ID: 25D74F3943625263

@ -63,7 +63,8 @@ function startup() {
// View file // View file
app.get('/:resourceId', (req, res) => { app.get('/:resourceId', (req, res) => {
let resourceId = req.params.resourceId; let resourceId = req.params.resourceId;
if (data[resourceId]) res.header('Accept-Ranges', 'bytes').header('etag', data[resourceId].filename).type(data[resourceId].mimetype).send(fs.readFileSync(path(data[resourceId].path)));// .sendFile(path(data[resourceId].path)); let fileData = fs.readFileSync(path(data[resourceId].path));
if (data[resourceId]) res.header('Accept-Ranges', 'bytes').header('Content-Length', fileData.byteLength).type(data[resourceId].mimetype).send(fileData);// .sendFile(path(data[resourceId].path));
else res.sendStatus(404); else res.sendStatus(404);
}); });

Loading…
Cancel
Save