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

fix: fs.readdir/readdirSync should support withFileTypes #24062

Merged
merged 1 commit into from Jun 12, 2020

Conversation

codebytere
Copy link
Member

Description of Change

Closes #19074.

Fixes an inconsistency between the Node.js implementations of fs.readdir and fs.readdirSync where we did not support withFileTypes under asar. When { withFileTypes: true } is passed as an option to either of the above methods, the methods should return fs.Dirent[].

This fixes the issue by using existing data we already have through archive.stat to appropriately return fs.Dirent[] when this option is passed.

cc @zcbenz @jkleinsc @MarshallOfSound

Checklist

Release Notes

Notes: Fixes an issue where withFileTypes was not supported as an option to fs.readdir or fs.readdirSync under asar.

@electron-cation electron-cation bot added the new-pr 🌱 PR opened in the last 24 hours label Jun 11, 2020
@codebytere codebytere changed the title fix: fs.readdir should support withFileTypes fix: fs.readdir/readdirSync should support withFileTypes Jun 11, 2020
Copy link
Member

@MarshallOfSound MarshallOfSound left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Question for future us, can we run all of node's fs specific tests but put the fixtures in an ASAR file to see this mismatch in support in CI?

@codebytere
Copy link
Member Author

Sounds pretty doable imo - i'll toss it on the backlog

@electron-cation electron-cation bot removed the new-pr 🌱 PR opened in the last 24 hours label Jun 12, 2020
@codebytere codebytere merged commit 66744ec into master Jun 12, 2020
@release-clerk
Copy link

release-clerk bot commented Jun 12, 2020

Release Notes Persisted

Fixes an issue where withFileTypes was not supported as an option to fs.readdir or fs.readdirSync under asar.

@trop
Copy link
Contributor

trop bot commented Jun 12, 2020

I have automatically backported this PR to "10-x-y", please check out #24106

@trop trop bot removed the target/10-x-y label Jun 12, 2020
@trop
Copy link
Contributor

trop bot commented Jun 12, 2020

I have automatically backported this PR to "8-x-y", please check out #24107

@trop
Copy link
Contributor

trop bot commented Jun 12, 2020

I have automatically backported this PR to "9-x-y", please check out #24108

@darron1217
Copy link

Please check this issue electron/asar#103 (comment)

It's still not working in electron 10.1.1
but it's working without option { withFileTypes: true }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Electron does not support withFileTypes in readdir inside asar
4 participants