| hide_title | true |
|---|---|
| custom_edit_url | |
| pagination_prev | |
| pagination_next |
Home > @rushstack/node-core-library > FileSystem > ensureEmptyFolder
Deletes the content of a folder, but not the folder itself. Also ensures the folder exists. Behind the scenes it uses fs-extra.emptyDirSync()<></>.
Signature:
static ensureEmptyFolder(folderPath: string): void;|
Parameter |
Type |
Description |
|---|---|---|
|
folderPath |
string |
The absolute or relative path to the folder which should have its contents deleted. |
Returns:
void
This is a workaround for a common race condition, where the virus scanner holds a lock on the folder for a brief period after it was deleted, causing EBUSY errors for any code that tries to recreate the folder.