Skip to content

Commit

Permalink
feat: 🎸 add options to promises.rmdir() method
Browse files Browse the repository at this point in the history
  • Loading branch information
streamich committed Jun 20, 2023
1 parent 71567c9 commit ce268bb
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ export const fs: IFs = createFsFromVolume(vol);
export const memfs = (json: DirectoryJSON = {}, cwd: string = '/') => {
const volume = Volume.fromJSON(json, cwd);
const fs = createFsFromVolume(volume);
return fs as IFs & typeof import('fs');
return fs;
};

declare let module;
Expand Down
5 changes: 3 additions & 2 deletions src/promises.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import {
IRealpathOptions,
IWriteFileOptions,
IStatOptions,
IRmdirOptions,
IRmOptions,
IFStatOptions,
} from './volume';
Expand Down Expand Up @@ -244,8 +245,8 @@ export default function createPromisesApi(vol: Volume): null | IPromisesAPI {
return promisify(vol, 'rename')(oldPath, newPath);
},

rmdir(path: PathLike): Promise<void> {
return promisify(vol, 'rmdir')(path);
rmdir(path: PathLike, options?: IRmdirOptions): Promise<void> {
return promisify(vol, 'rmdir')(path, options);
},

rm(path: PathLike, options?: IRmOptions): Promise<void> {
Expand Down
3 changes: 3 additions & 0 deletions src/volume.ts
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,10 @@ const getMkdirOptions = (options): IMkdirOptions => {

// Options for `fs.rmdir` and `fs.rmdirSync`
export interface IRmdirOptions {
/** @deprecated */
recursive?: boolean;
maxRetries?: number;
retryDelay?: number;
}
const rmdirDefaults: IRmdirOptions = {
recursive: false,
Expand Down

0 comments on commit ce268bb

Please sign in to comment.