Update server.js
Browse files
server.js
CHANGED
|
@@ -27,17 +27,19 @@ const scheduleFileDeletion = (filePath, delay = 600000) => {
|
|
| 27 |
};
|
| 28 |
|
| 29 |
// Function to download file using aria2c (super fast)
|
| 30 |
-
|
|
|
|
| 31 |
return new Promise((resolve, reject) => {
|
| 32 |
-
const
|
| 33 |
-
console.log(`π Starting fast download: ${
|
| 34 |
|
| 35 |
-
exec(
|
| 36 |
if (error) {
|
| 37 |
-
console.error(`β
|
|
|
|
| 38 |
return reject(error);
|
| 39 |
}
|
| 40 |
-
console.log(`β
|
| 41 |
resolve(filePath);
|
| 42 |
});
|
| 43 |
});
|
|
|
|
| 27 |
};
|
| 28 |
|
| 29 |
// Function to download file using aria2c (super fast)
|
| 30 |
+
|
| 31 |
+
const downloadWithAria2 = (fileUrl, filePath) => {
|
| 32 |
return new Promise((resolve, reject) => {
|
| 33 |
+
const aria2Command = `aria2c --allow-insecure -x 16 -s 16 -k 1M -o "${filePath}" "${fileUrl}"`;
|
| 34 |
+
console.log(`π Starting fast download: ${aria2Command}`);
|
| 35 |
|
| 36 |
+
exec(aria2Command, (error, stdout, stderr) => {
|
| 37 |
if (error) {
|
| 38 |
+
console.error(`β Aria2 Error: ${error.message}`);
|
| 39 |
+
console.error(`π΄ STDERR: ${stderr}`);
|
| 40 |
return reject(error);
|
| 41 |
}
|
| 42 |
+
console.log(`β
Aria2 Output: ${stdout || stderr}`);
|
| 43 |
resolve(filePath);
|
| 44 |
});
|
| 45 |
});
|