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.promises.readdir( path, { withFileTypes: true } ) error #22829

Closed
jackschmidt opened this issue Sep 12, 2018 · 2 comments
Closed

fs.promises.readdir( path, { withFileTypes: true } ) error #22829

jackschmidt opened this issue Sep 12, 2018 · 2 comments
Labels
fs Issues and PRs related to the fs subsystem / file system. promises Issues and PRs related to ECMAScript promises.

Comments

@jackschmidt
Copy link

  • Version: v10.10.0
  • Platform: Linux hostname 4.15.0-33-generic docs: re-word project messaging #36-Ubuntu SMP Wed Aug 15 16:00:05 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
  • Subsystem: fs

I would expect the following to run without error

fs.promises.readdir( ".", { withFileTypes: true } ).
then( ret => console.log({ret}), err => console.log({err}) );

and produce output similar to that of:

fs.readdir( ".", { withFileTypes : true },
(err,ret) => err ? console.log({err}) : console.log({ret}) );

However, the promise version prints this instead:

{ err:
   TypeError: Cannot assign to read only property '0' of string '.git'
       at getDirents (internal/fs/utils.js:143:18)
       at Promise (internal/util.js:276:30)
       at new Promise (<anonymous>)
       at getDirents (internal/util.js:275:12)
       at Object.readdir (internal/fs/promises.js:305:5) }

The problem happens when compiled from source or when installed from apt:

Package: nodejs
Version: 10.10.0-1nodesource1
Maintainer: Chris Lea <[email protected]>
@vsemozhetbyt vsemozhetbyt added fs Issues and PRs related to the fs subsystem / file system. promises Issues and PRs related to ECMAScript promises. labels Sep 13, 2018
@cedric05
Copy link

@vsemozhetbyt shall i work on it?

@vsemozhetbyt
Copy link
Contributor

@cedric05 If I am not mistaken, this issue is fixed in #22832
But thank you for the offer and good luck in any future contribution)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fs Issues and PRs related to the fs subsystem / file system. promises Issues and PRs related to ECMAScript promises.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants