Remove unnecessary check

Mentioned in rmdir docs

Tested on macOS with a node shell

    > await fs.rmdir("/tmp/foo/bar/baz")
    Uncaught [Error: ENOTEMPTY: directory not empty, rmdir '/tmp/foo/bar/baz']
This commit is contained in:
Manav Rathi 2024-04-14 18:06:49 +05:30
parent fb5ae3a2ac
commit 0f1c2fa1cd
No known key found for this signature in database

View file

@ -107,10 +107,6 @@ export const isFolder = async (dirPath: string) => {
};
export const deleteFolder = async (folderPath: string) => {
// Ensure folder is empty
const files = await fs.readdir(folderPath);
if (files.length > 0) throw new Error("Folder is not empty");
// rm -rf it
await fs.rmdir(folderPath);
};