Skip to content

Commit e5c94ce

Browse files
committed
refactor: rename directory removal methods to remove and removeSync, adding deprecated aliases for rm and rmSync
1 parent 41fafd6 commit e5c94ce

File tree

1 file changed

+18
-4
lines changed

1 file changed

+18
-4
lines changed

packages/fs/src/dir.lib.ts

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -458,10 +458,10 @@ Trying to access a dir file from an absolute paths:
458458
* const tempDir = fsDir("./temp");
459459
*
460460
* // Remove directory and all contents
461-
* await tempDir.rm();
461+
* await tempDir.remove();
462462
* ```
463463
*/
464-
public async rm(): Promise<void> {
464+
public async remove(): Promise<void> {
465465
try {
466466
await fs.rm(this._path, { recursive: true });
467467
} catch (error: any) {
@@ -472,6 +472,13 @@ Trying to access a dir file from an absolute paths:
472472
}
473473
}
474474

475+
/**
476+
* @deprecated Use {@link remove} instead.
477+
*/
478+
public rm(): Promise<void> {
479+
return this.remove();
480+
}
481+
475482
/**
476483
* Remove the directory and all its contents recursively synchronously.
477484
* If the directory doesn't exist, the operation is silently ignored.
@@ -482,10 +489,10 @@ Trying to access a dir file from an absolute paths:
482489
* const tempDir = fsDir("./temp");
483490
*
484491
* // Remove directory and all contents immediately
485-
* tempDir.rmSync();
492+
* tempDir.removeSync();
486493
* ```
487494
*/
488-
public rmSync(): void {
495+
public removeSync(): void {
489496
try {
490497
fsSync.rmSync(this._path, { recursive: true });
491498
} catch (error: any) {
@@ -496,6 +503,13 @@ Trying to access a dir file from an absolute paths:
496503
}
497504
}
498505

506+
/**
507+
* @deprecated Use {@link removeSync} instead.
508+
*/
509+
public rmSync(): void {
510+
this.removeSync();
511+
}
512+
499513
/**
500514
* Find files in the directory that match the specified glob patterns.
501515
*

0 commit comments

Comments
 (0)