fix(core): update

This commit is contained in:
2021-04-06 02:34:52 +00:00
parent 7d6bbd289d
commit 191e0b8e05
3 changed files with 131 additions and 35 deletions

View File

@ -201,4 +201,25 @@ export class Directory {
const path = plugins.path.join(this.getBasePath(), pathArg);
await this.bucketRef.fastRemove(path);
}
/**
* deletes the directory with all its contents
*/
public async deleteWithAllContents() {
const deleteDirectory = async (directoryArg: Directory) => {
const childDirectories = await directoryArg.listDirectories();
if (childDirectories.length === 0) {
console.log('directory empty! Path complete!');
} else {
for (const childDir of childDirectories) {
await deleteDirectory(childDir);
}
}
const files = await directoryArg.listFiles();
for (const file of files) {
await directoryArg.fastRemove(file.name);
}
};
await deleteDirectory(this);
}
}