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.readdir(sync) inside asar does not work with withFileTypes after "fix" #24292
Comments
Are you sure you're calling it correctly? I ran the following: https://gist.github.com/a19c56fece174de46486f4d4a2934dfb With the following test fixture: Which seems correct to me. |
Strange, it works fine with the asars you sent, however it does not work with any asar I make myself, I tried asar versions 2 & 3 and both simply log empty array when adding withFileTypes, where as without withFileTypes, it logs the correct array of names in the dir |
@xssc would you be willing to send an example of a fixture that fails for you? I of course want to make it work for you/others but it's hard if i can't repro it over here 😅 |
Closing this out as it appears to work - i'll reopen should more info come to light. |
@codebytere I have the same problem - with archive created by
console.log("KJ's test (test_app.asar/data/html_assets)")
const p = path.join(__dirname, "test_app.asar", "data/html_assets");
const dirs = fs.readdirSync(p, { withFileTypes: true });
const entries = fs.readdirSync(p);
console.log("With file types:", dirs);
console.log("Without file types:", entries);
console.log("codebytere's test (a.asar/dir1)")
const p1 = path.join(__dirname, 'test.asar', 'a.asar', 'dir1');
const dirs1 = fs.readdirSync(p1, { withFileTypes: true });
console.log("With file types:", dirs1) and received the following:
Tested archive (test_app.asar - mine, zipped)
|
Preflight Checklist
Issue Details
Expected Behavior
fs.readdirsync should return an array of dirents
Actual Behavior
always returns an empty array in asar after #24062
To Reproduce
call fs.readdir/sync on any dir inside an asar
The text was updated successfully, but these errors were encountered: