Delete unfinished downloads in case of retry

This commit is contained in:
jarlob
2023-05-24 11:25:50 +02:00
parent 9bd852a71b
commit 69f9ecc2f4

View File

@@ -1,4 +1,4 @@
import { appendFile, pathExists } from "fs-extra";
import { appendFile, pathExists, rm } from "fs-extra";
import fetch from "node-fetch";
import { EOL } from "os";
import { join } from "path";
@@ -82,6 +82,9 @@ export class VariantAnalysisResultsManager extends DisposableObject {
const zipFilePath = join(resultDirectory, "results.zip");
// in case of restarted download delete possible artifact from previous download
await rm(zipFilePath, { force: true });
const response = await fetch(repoTask.artifactUrl);
let responseSize = parseInt(response.headers.get("content-length") || "0");