diff --git a/src/download/download-engine/engine/download-engine-nodejs.ts b/src/download/download-engine/engine/download-engine-nodejs.ts index 09c6ee3..5acdd66 100644 --- a/src/download/download-engine/engine/download-engine-nodejs.ts +++ b/src/download/download-engine/engine/download-engine-nodejs.ts @@ -95,24 +95,26 @@ export default class DownloadEngineNodejs { + await super.close(); - if (this.status.downloadStatus != DownloadStatus.Finished) { + if (deleteFile || deleteTempFile && this.status.downloadStatus != DownloadStatus.Finished) { try { - await fs.unlink(this.options.writeStream.path); + await fs.unlink(this.fileAbsolutePath); } catch {} } }