diff --git a/ass.js b/ass.js index 4e309f0..1077954 100755 --- a/ass.js +++ b/ass.js @@ -63,7 +63,8 @@ function startup() { // View file app.get('/:resourceId', (req, res) => { 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); });