1
0
Fork 0

Test out checking for fileexists in rmFile

pull/1266/head
Ferenc Hammerl 2022-12-14 01:17:17 +01:00
parent c91bdbadbf
commit cc9ec0424e
1 changed files with 15 additions and 5 deletions

View File

@ -270,6 +270,16 @@ export async function getFileSize(filePath: string): Promise<number> {
}
export async function rmFile(filePath: string): Promise<void> {
// TODO: find actual fix
// node 16 `CreateWriteStream` no longer creates a file
// download-http-client.ts#L151 no longer creates a file and we fail here
try {
await fs.stat(filePath)
}
catch (e) {
console.log("File does not exist.");
return;
}
await fs.unlink(filePath)
}