Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

.rm/.rmSync are not available #884

Closed
alienzhou opened this issue Nov 18, 2022 · 2 comments · Fixed by #909
Closed

.rm/.rmSync are not available #884

alienzhou opened this issue Nov 18, 2022 · 2 comments · Fixed by #909
Labels

Comments

@alienzhou
Copy link
Contributor

image

It seems that memfs has implemented .rm and .rmSync:

memfs/src/volume.ts

Lines 2044 to 2053 in ce45b54

public rmSync(path: PathLike, options?: IRmOptions): void {
this.rmBase(pathToFilename(path), options);
}
public rm(path: PathLike, callback: TCallback<void>): void;
public rm(path: PathLike, options: IRmOptions, callback: TCallback<void>): void;
public rm(path: PathLike, a: TCallback<void> | IRmOptions, b?: TCallback<void>): void {
const [opts, callback] = getRmOptsAndCb(a, b);
this.wrapAsync(this.rmBase, [pathToFilename(path), opts], callback);
}

But memfs uses fs-monkey to bind methods:

memfs/src/index.ts

Lines 39 to 40 in ce45b54

for (const method of fsSyncMethods) if (typeof vol[method] === 'function') fs[method] = vol[method].bind(vol);
for (const method of fsAsyncMethods) if (typeof vol[method] === 'function') fs[method] = vol[method].bind(vol);

.rm and .rmSync are not supported in the fs-monkey's latest version yet: streamich/fs-monkey#362

Maybe updating this dependency will fix it.

@blimmer
Copy link
Contributor

blimmer commented Jun 6, 2023

It looks like they just released fs-monkey@1.0.4 last week (https://github.com/streamich/fs-monkey/releases/tag/v1.0.4), which is supported in the memfs dependency definition:

memfs/package.json

Lines 78 to 80 in 09eab27

"dependencies": {
"fs-monkey": "^1.0.3"
},

I updated my transitive dependencies to grab the newer fs-monkey version and rmSync works now.

I also proposed #909 to specify 1.0.4 as the minimum.

@streamich
Copy link
Owner

🎉 This issue has been resolved in version 3.5.3 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants