From d4d254709e5dd0f9f3b905a8c581bc5303dd7b5a Mon Sep 17 00:00:00 2001 From: sdobbert Date: Thu, 29 Feb 2024 10:49:04 +0100 Subject: [PATCH] delete temporary files --- src/create-contour/index.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/create-contour/index.js b/src/create-contour/index.js index e66695e..70d0518 100644 --- a/src/create-contour/index.js +++ b/src/create-contour/index.js @@ -94,6 +94,17 @@ const contourLinesWorker = async (workerJob, inputs) => { if (client) { await client.end(); } + // delete temporary files + const filesToDelete = fs.readdirSync('/tmp/') + for (const file of filesToDelete) { + + await fs.unlink(file, (err => { + if (err) logger.error(err); + else { + logger.info('Deleted file:', file) + } + })); + } } workerJob.status = 'success';