🎥 Make videos programmatically with React
Update clean-tmpdir.ts
Jonny Burgerac9f1cf3147c
diff --git a/packages/lambda/src/functions/helpers/clean-tmpdir.ts b/packages/lambda/src/functions/helpers/clean-tmpdir.tsindex be6c8540c5..1c7ec6e790 100644--- a/packages/lambda/src/functions/helpers/clean-tmpdir.ts+++ b/packages/lambda/src/functions/helpers/clean-tmpdir.ts@@ -1,13 +1,5 @@import fs from 'fs';import {join} from 'path';-import {- CONCAT_TMPDIR,- DOWNLOADS_DIR,- OUTPUT_PATH_PREFIX,- REMOTION_CONCATED_TMP_PREFIX,- REMOTION_FILELIST_TMP_PREFIX,- RENDERER_PATH_PREFIX,-} from '../../shared/constants';export let deletedFiles: string[] = [];export let deletedFilesSize = 0;@@ -16,30 +8,20 @@ const deleteAllFilesInAFolderRecursively = (path: string) => {const files = fs.readdirSync(path);files.forEach((file) => {const filePath = join(path, file);- if (- !filePath.startsWith(OUTPUT_PATH_PREFIX) &&- !filePath.startsWith(DOWNLOADS_DIR) &&- !filePath.startsWith(RENDERER_PATH_PREFIX) &&- !filePath.startsWith(CONCAT_TMPDIR) &&- !filePath.startsWith(REMOTION_CONCATED_TMP_PREFIX) &&- !filePath.startsWith(REMOTION_FILELIST_TMP_PREFIX) &&- !filePath.startsWith('/tmp/puppeteer_dev_chrome')- ) {- return;- }-try {const stat = fs.statSync(filePath);if (stat.isDirectory()) {deleteAllFilesInAFolderRecursively(filePath);} else {fs.unlinkSync(filePath);- deletedFiles.push(filePath);deletedFilesSize += stat.size;}} catch (err) {- // TODO: why can statsync fail?+ // Can fail if file was already deleted by cleanup. In that case+ // let's ignore it}++ deletedFiles.push(filePath);});if (path !== '/tmp') {fs.rmSync(path, {recursive: true, force: true});