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

fs.stat is an asynchronous function, that returns a Promise<fs.Stats>. isFile is a property on fs.Stats objects #390

Open
emarteca opened this issue Nov 8, 2021 · 0 comments

Comments

@emarteca
Copy link

emarteca commented Nov 8, 2021

Here you're calling isFile directly on the return of fs.stat.
fs.stat is an asynchronous function, that returns a Promise<fs.Stats>. isFile is a property on fs.Stats objects. So, calling isFile on the promise is not valid -- the promise needs to be resolved first.

This could be fixed by awaiting the result of fs.stat:

var stat = await fs.stat(path, _);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant