Commit b4b101f
fs: default open/openSync flags argument to 'r'
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>1 parent 0312d8b commit b4b101fCopy full SHA for b4b101f
File tree
Expand file treeCollapse file tree
4 files changed
+70
-12
lines changedOpen diff view settings
Filter options
- doc/api
- lib
- internal/fs
- test/parallel
Expand file treeCollapse file tree
4 files changed
+70
-12
lines changedOpen diff view settings
Collapse file
+5-3Lines changed: 5 additions & 3 deletions
- Display the source diff
- Display the rich diff
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
2309 | 2309 | |
2310 | 2310 | |
2311 | 2311 | |
2312 | | - |
| 2312 | + |
2313 | 2313 | |
2314 | 2314 | |
2315 | 2315 | |
| ||
2324 | 2324 | |
2325 | 2325 | |
2326 | 2326 | |
| 2327 | + |
2327 | 2328 | |
2328 | 2329 | |
2329 | 2330 | |
| ||
2345 | 2346 | |
2346 | 2347 | |
2347 | 2348 | |
2348 | | - |
| 2349 | + |
2349 | 2350 | |
2350 | 2351 | |
2351 | 2352 | |
| ||
2356 | 2357 | |
2357 | 2358 | |
2358 | 2359 | |
2359 | | - |
| 2360 | + |
| 2361 | + |
2360 | 2362 | |
2361 | 2363 | |
2362 | 2364 | |
|
Collapse file
+12-7Lines changed: 12 additions & 7 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
345 | 345 | |
346 | 346 | |
347 | 347 | |
348 | | - |
| 348 | + |
349 | 349 | |
350 | 350 | |
351 | 351 | |
| ||
411 | 411 | |
412 | 412 | |
413 | 413 | |
414 | | - |
415 | | - |
416 | | - |
| 414 | + |
| 415 | + |
| 416 | + |
417 | 417 | |
418 | | - |
| 418 | + |
| 419 | + |
| 420 | + |
| 421 | + |
| 422 | + |
| 423 | + |
419 | 424 | |
420 | | - |
421 | 425 | |
| 426 | + |
422 | 427 | |
423 | 428 | |
424 | 429 | |
| ||
433 | 438 | |
434 | 439 | |
435 | 440 | |
436 | | - |
| 441 | + |
437 | 442 | |
438 | 443 | |
439 | 444 | |
|
Collapse file
lib/internal/fs/promises.js
Copy file name to clipboardExpand all lines: lib/internal/fs/promises.js+3-2Lines changed: 3 additions & 2 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
196 | 196 | |
197 | 197 | |
198 | 198 | |
| 199 | + |
| 200 | + |
199 | 201 | |
200 | 202 | |
201 | 203 | |
202 | | - |
203 | | - |
| 204 | + |
204 | 205 | |
205 | 206 | |
206 | 207 | |
|
Collapse file
test/parallel/test-fs-open.js
Copy file name to clipboardExpand all lines: test/parallel/test-fs-open.js+50Lines changed: 50 additions & 0 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
36 | 36 | |
37 | 37 | |
38 | 38 | |
| 39 | + |
| 40 | + |
| 41 | + |
| 42 | + |
| 43 | + |
| 44 | + |
39 | 45 | |
40 | 46 | |
41 | 47 | |
| ||
44 | 50 | |
45 | 51 | |
46 | 52 | |
| 53 | + |
| 54 | + |
| 55 | + |
| 56 | + |
| 57 | + |
| 58 | + |
| 59 | + |
| 60 | + |
| 61 | + |
| 62 | + |
| 63 | + |
| 64 | + |
| 65 | + |
| 66 | + |
| 67 | + |
| 68 | + |
| 69 | + |
| 70 | + |
| 71 | + |
| 72 | + |
| 73 | + |
| 74 | + |
| 75 | + |
| 76 | + |
| 77 | + |
| 78 | + |
| 79 | + |
| 80 | + |
| 81 | + |
| 82 | + |
| 83 | + |
| 84 | + |
| 85 | + |
47 | 86 | |
48 | 87 | |
49 | 88 | |
| ||
59 | 98 | |
60 | 99 | |
61 | 100 | |
| 101 | + |
| 102 | + |
| 103 | + |
| 104 | + |
| 105 | + |
| 106 | + |
| 107 | + |
| 108 | + |
| 109 | + |
| 110 | + |
| 111 | + |
62 | 112 | |
0 commit comments