-
-
Notifications
You must be signed in to change notification settings - Fork 33.4k
Closed
Labels
confirmed-bugIssues with confirmed bugs.Issues with confirmed bugs.fsIssues and PRs related to the fs subsystem / file system.Issues and PRs related to the fs subsystem / file system.good first issueIssues that are suitable for first-time contributors.Issues that are suitable for first-time contributors.
Description
- Version: 12.16.3
- Platform: linux64
- Subsystem: gentoo
What steps will reproduce the bug?
reading directory with files names using buffer as path does not work.
const fs = require('fs');
fs.readdir( Buffer.from( "."),{withFileTypes:true,encoding:"buffer"},(e,d)=>console.log("dir",d));
It works correct in version 12.14.0 but after upgrade it stopped to work.
using it without files types works:
// fs.readdir( Buffer.from( "."),{withFileTypes:false,encoding:"buffer"},(e,d)=>console.log("dir",d));
How often does it reproduce? Is there a required condition?
every time
What is the expected behavior?
get directory entries with file types i.e. array of Dirent objects
What do you see instead?
error message:
Uncaught:
TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received an instance of Buffer
at validateString (internal/validators.js:117:11)
at Object.join (path.js:1039:7)
at getDirents (internal/fs/utils.js:159:39)
at FSReqCallback.req.oncomplete (fs.js:858:7) {
code: 'ERR_INVALID_ARG_TYPE'
}
Additional information
This bug is degradation because it doesn't exists in version 12.14.0 and present in versions 12.16.1 and 12.16.3 at least.
I use buffer instead of string because working with my old archives with non utf-8 names.
himself65 and shackijj
Metadata
Metadata
Assignees
Labels
confirmed-bugIssues with confirmed bugs.Issues with confirmed bugs.fsIssues and PRs related to the fs subsystem / file system.Issues and PRs related to the fs subsystem / file system.good first issueIssues that are suitable for first-time contributors.Issues that are suitable for first-time contributors.