fix(ext/node): fs.open
and fs.openSync
compatibility
#30191
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Notable changes:
Deno.open
andnode:fs.open
.existenceCheckRequired
andDeno.lstatSync
calls, as the op layer already handles that whenoptions.create_new
is true and uses synchronous I/O whenO_SYNC
is passed.O_SYNC
).prefer-primordials
lint rule.I decided to make a separate op function between the Deno fs and node, because Deno.OpenOptions currently doesn't allow passing numeric flags.
There's a caveat though, because the
node:fs.constants
are only correctly defined for macOS, passing these constants to the open function might not work as intended (excludingO_APPEND
,O_CREAT
,O_EXCL
,O_TRUNC
,O_RDONLY
,O_WRONLY
,O_RDWR
). PR #30113 fixes this. Once merged it will allow parallel/test-fs-open-flags.js to pass.I'm very open for any feedback.
Towards: #29972, #24236