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

lstat is not a function #932

Closed
ghost opened this issue Dec 10, 2021 · 6 comments
Closed

lstat is not a function #932

ghost opened this issue Dec 10, 2021 · 6 comments

Comments

@ghost
Copy link

ghost commented Dec 10, 2021

  • Operating System: Linux fedora 5.15.6-201.fsync.fc35.x86_64 #1 SMP Sat Dec 4 13:55:17 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
  • Node.js version: v16.11.0
  • fs-extra version: fs-extra@npm:10.0.0

Code:

if (!(await fs.pathExists(somePath) || (await fs.lstat(somePath)).isDirectory()) {
 ...
}
// Somehow, it doesn't complain that error when you remove await, but it makes much more errors, BTW, this is in TypeScript.

Error:

TypeError: fs.lstat is not a function
 at [redacted] // from my project
@RyanZim
Copy link
Collaborator

RyanZim commented Dec 10, 2021

You have your parenthesis misplaced; you want to (await fs.lstat(somePath)).isDirectory(), since isDirectory() is a method of the resolved value of the promise.

@ghost
Copy link
Author

ghost commented Dec 11, 2021

even with parenthesis fixed, it still errors nvm im dumb

@ghost ghost closed this as completed Dec 11, 2021
@ghost
Copy link
Author

ghost commented Dec 11, 2021

wait, i'm not dumb, fse.lstat just doesn't exist in fs-extra, i just replaced fse with fs

@ghost ghost reopened this Dec 11, 2021
@RyanZim
Copy link
Collaborator

RyanZim commented Dec 11, 2021

fs-extra definitely does support lstat; so I'm not sure why you're getting an error.

@cgarrovillo
Copy link

bumping this

@RyanZim
Copy link
Collaborator

RyanZim commented Mar 16, 2022

I am unable to reproduce this, so not sure I can do anything here. If someone comes up with a way to reproduce or a fix, please post here. However, I strongly suspect this is some obscure bug in consumer code.

@RyanZim RyanZim closed this as completed Mar 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants