|
|
@ -74,10 +74,12 @@ router.get('/direct*', (req: AssRequest, res: AssResponse, next) => data.get(req
|
|
|
|
sia: () => SkynetDownload(fileData)
|
|
|
|
sia: () => SkynetDownload(fileData)
|
|
|
|
.then((stream) => stream.pipe(res))
|
|
|
|
.then((stream) => stream.pipe(res))
|
|
|
|
.then(() => SkynetDelete(fileData)),
|
|
|
|
.then(() => SkynetDelete(fileData)),
|
|
|
|
local: () => {
|
|
|
|
local: () => fs.pathExists(path(fileData.path))
|
|
|
|
res.header('Accept-Ranges', 'bytes').header('Content-Length', `${fileData.size}`).type(fileData.mimetype);
|
|
|
|
.then((exists) => {
|
|
|
|
fs.createReadStream(fileData.path).pipe(res);
|
|
|
|
if (!exists) throw new Error('File does not exist');
|
|
|
|
}
|
|
|
|
res.header('Accept-Ranges', 'bytes').header('Content-Length', `${fileData.size}`).type(fileData.mimetype);
|
|
|
|
|
|
|
|
fs.createReadStream(fileData.path).pipe(res);
|
|
|
|
|
|
|
|
})
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
return uploaders[fileData.randomId.startsWith('sia://') ? 'sia' : s3enabled ? 's3' : 'local']();
|
|
|
|
return uploaders[fileData.randomId.startsWith('sia://') ? 'sia' : s3enabled ? 's3' : 'local']();
|
|
|
|