Skip to content

Latest commit

 

History

History
64 lines (34 loc) · 1.23 KB

File metadata and controls

64 lines (34 loc) · 1.23 KB
hide_title true
custom_edit_url
pagination_prev
pagination_next

Home > @rushstack/node-core-library > FileSystem > ensureEmptyFolder

FileSystem.ensureEmptyFolder() method

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;

Parameters

Parameter

Type

Description

folderPath

string

The absolute or relative path to the folder which should have its contents deleted.

Returns:

void

Remarks

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.