fs: default open/openSync flags argument to 'r'#23767
fs: default open/openSync flags argument to 'r'#23767bnoordhuis wants to merge 4 commits intonodejs:masterfrom
Conversation
jasnell
left a comment
There was a problem hiding this comment.
LGTM. What would the semver-iness of this be? minor?
doc/api/fs.md
Outdated
There was a problem hiding this comment.
Nits:
- Missing period.
- One unneeded space in the next line indent alignment,
- It seems our common style is to place
**Default:**notes at the end of a parameter description:
* `flags` {string|number} See [support of file system `flags`][].
**Default:** `'r'`.
doc/api/fs.md
Outdated
There was a problem hiding this comment.
Ditto:
* `flags` {string|number} See [support of file system `flags`][].
**Default:** `'r'`.|
Should the |
doc/api/fs.md
Outdated
There was a problem hiding this comment.
| ## fs.open(path[, flags, mode], callback) | |
| ## fs.open(path[, flags[, mode]], callback) |
There was a problem hiding this comment.
Is this a style we use elsewhere? It looks unfamiliar to me.
There was a problem hiding this comment.
Yes, see https://nodejs.org/api/buffer.html#buffer_buf_fill_value_offset_end_encoding for example.
There was a problem hiding this comment.
The [, flags[, mode]], is the right doc convention, and looks to agree with how it is now implemented.
Make fs.open() and fs.openSync() more economic to use by making the
flags argument optional. You can now write:
fs.open(file, cb)
Instead of the more verbose:
fs.open(file, 'r', cb)
This idiom is already supported by functions like fs.readFile().
38bfd21 to
43e6f91
Compare
|
Updated based on feedback:
|
|
Is this semver minor or major? i.e. could any existing code break? CI: |
Yes, minor. |
|
Test failure is #23807 and unrelated (wasn't fixed yet when the CI was started.) |
|
Last CI was green. Any reason this shouldn't land? |
|
I think this can land, my nit can be addressed in another PR if wanted. |
|
Applied the nit. |
Make fs.open() and fs.openSync() more economic to use by making the
flags argument optional. You can now write:
fs.open(file, cb)
Instead of the more verbose:
fs.open(file, 'r', cb)
This idiom is already supported by functions like fs.readFile().
PR-URL: nodejs#23767
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
|
Landed in 482b56a |
Make fs.open() and fs.openSync() more economic to use by making the
flags argument optional. You can now write:
fs.open(file, cb)
Instead of the more verbose:
fs.open(file, 'r', cb)
This idiom is already supported by functions like fs.readFile().
PR-URL: #23767
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Make fs.open() and fs.openSync() more economic to use by making the
flags argument optional. You can now write:
fs.open(file, cb)
Instead of the more verbose:
fs.open(file, 'r', cb)
This idiom is already supported by functions like fs.readFile().
PR-URL: #23767
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Was missed on original PR. Ref: nodejs#23767
Was missed on original PR. Ref: nodejs#23767 PR-URL: nodejs#24240 Refs: nodejs#23767 Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
Was missed on original PR. Ref: nodejs#23767 PR-URL: nodejs#24240 Refs: nodejs#23767 Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
Make fs.open() and fs.openSync() more economic to use by making the
flags argument optional. You can now write:
fs.open(file, cb)
Instead of the more verbose:
fs.open(file, 'r', cb)
This idiom is already supported by functions like fs.readFile().
PR-URL: #23767
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Signed-off-by: Beth Griggs <Bethany.Griggs@uk.ibm.com>
Make fs.open() and fs.openSync() more economic to use by making the
flags argument optional. You can now write:
Instead of the more verbose:
This idiom is already supported by functions like fs.readFile().