From 760a39afb9f2c4703e393b725927f5d2bcab233d Mon Sep 17 00:00:00 2001 From: Yang Cao Date: Thu, 3 Dec 2020 13:34:59 -0500 Subject: [PATCH] Try close stream before unlink --- src/internal/download-http-client.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/internal/download-http-client.ts b/src/internal/download-http-client.ts index 7fb06a4..bd409eb 100644 --- a/src/internal/download-http-client.ts +++ b/src/internal/download-http-client.ts @@ -223,6 +223,7 @@ export class DownloadHttpClient { const resetDestinationStream = async ( fileDownloadPath: string ): Promise => { + destinationStream.close() await rmFile(fileDownloadPath) destinationStream = fs.createWriteStream(fileDownloadPath) }