fixed queue
This commit is contained in:
3
main.ts
3
main.ts
@@ -246,8 +246,8 @@ class DownloadQueue {
|
||||
|
||||
private async processDownload(url: string, folder: string, filename: string): Promise<void> {
|
||||
await downloadSong(url, folder, filename);
|
||||
songCount++; // Increment the song count after successful download
|
||||
console.log(`${songCount} songs downloaded successfully \n${this.queue.length} remaining`);
|
||||
songCount++; // Increment the song count after completion
|
||||
}
|
||||
}
|
||||
|
||||
@@ -304,7 +304,6 @@ function downloadSong(downloadLink: string, folder: string, filename: string): P
|
||||
https.get(downloadLink, (response) => {
|
||||
response.pipe(fs.createWriteStream(`${folder}/${filename}.mp3`))
|
||||
.on('finish', () => {
|
||||
songCount++
|
||||
resolve();
|
||||
})
|
||||
.on('error', (error: Error) => {
|
||||
|
||||
Reference in New Issue
Block a user