added download only mode that simply downloads files to the client when the server finishes the download

added dependency on savefile library for download-only mode
This commit is contained in:
Isaac Grynsztein
2020-02-11 13:10:02 -05:00
parent 10c90a01f2
commit ba5592015d
5 changed files with 69 additions and 37 deletions

View File

@@ -255,9 +255,7 @@ app.post('/fileStatusMp4', function(req, res) {
var fullpath = videoPath + name + ".mp4";
if (fs.existsSync(fullpath)) {
exists = [basePath + videoPath + name, getFileSizeMp4(name)];
}
else
{
} else {
var percent = 0;
var size = getFileSizeMp4(name);
var downloaded = getAmountDownloadedMp4(name);
@@ -386,6 +384,19 @@ app.post('/deleteMp4', function(req, res) {
}
});
app.post('/downloadFile', function(req, res) {
let fileName = req.body.fileName;
let type = req.body.type;
let file = null;
if (type === 'audio') {
file = __dirname + '/' + 'audio/' + fileName + '.mp3';
} else if (type === 'video') {
file = __dirname + '/' + 'video/' + fileName + '.mp4';
}
res.sendFile(file);
});
app.get('/video/:id', function(req , res){
var head;

View File

@@ -16,7 +16,8 @@
},
"Extra": {
"title_top": "Youtube Downloader",
"file_manager_enabled": true
"download_only_mode": false,
"file_manager_enabled": true
}
}
}