From b86620f051b6698711ebe5bfb4e03aaa04630481 Mon Sep 17 00:00:00 2001 From: Abhinav Date: Tue, 25 Apr 2023 18:23:03 +0530 Subject: [PATCH] fix deleteEmptyFolder api issues --- src/services/fs.ts | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/services/fs.ts b/src/services/fs.ts index baf05d3fc..ad9a35f6c 100644 --- a/src/services/fs.ts +++ b/src/services/fs.ts @@ -262,11 +262,8 @@ export async function moveFile( export async function deleteEmptyFolder(folderPath: string) { if (!existsSync(folderPath)) { - throw new Error('Folder does not exist'); - } - const files = await fs.readdir(folderPath); - if (files.length > 0) { - throw new Error('Folder is not empty'); + return; } + // TODO: handle error and throw custom error await fs.rmdir(folderPath); }