Reaperxxxx commited on
Commit
ad4d91f
Β·
verified Β·
1 Parent(s): 24927fd

Update server.js

Browse files
Files changed (1) hide show
  1. server.js +8 -6
server.js CHANGED
@@ -27,17 +27,19 @@ const scheduleFileDeletion = (filePath, delay = 600000) => {
27
  };
28
 
29
  // Function to download file using aria2c (super fast)
30
- const downloadFile = (fileUrl, filePath) => {
 
31
  return new Promise((resolve, reject) => {
32
- const aria2Cmd = `aria2c -x 16 -s 16 -k 1M -o "${filePath}" "${fileUrl}"`;
33
- console.log(`πŸš€ Starting fast download: ${aria2Cmd}`);
34
 
35
- exec(aria2Cmd, (error, stdout, stderr) => {
36
  if (error) {
37
- console.error(`❌ Download Error: ${error.message}`);
 
38
  return reject(error);
39
  }
40
- console.log(`βœ… Download Complete: ${filePath}`);
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
  });