Skip to content

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

Description

@jackschmidt
  • 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 <chl@nodesource.com>

Activity

  1. added
    fsIssues and PRs related to file-system APIs and the fs module.
    promisesIssues and PRs related to ECMAScript promises.
    on Sep 13, 2018
  2. cedric05 commented on Sep 17, 2018

    @cedric05

    @vsemozhetbyt shall i work on it?

  3. vsemozhetbyt commented on Sep 17, 2018

    @vsemozhetbyt
    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    fsIssues and PRs related to file-system APIs and the fs module.promisesIssues and PRs related to ECMAScript promises.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions