Commit 7added3
fs: pass err to callback if buffer is too big
In fs.readFile, if an encoding is specified and toString fails, do not
throw an error. Instead, pass the error to the callback.
Fixes: #2767
PR-URL: #3485
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Trevor Norris <trev.norris@gmail.com>1 parent 1a41feb commit 7added3Copy full SHA for 7added3
File tree
Expand file treeCollapse file tree
2 files changed
+67
-3
lines changedOpen diff view settings
Filter options
- lib
- test/parallel
Expand file treeCollapse file tree
2 files changed
+67
-3
lines changedOpen diff view settings
Collapse file
+15-3Lines changed: 15 additions & 3 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
395 | 395 | |
396 | 396 | |
397 | 397 | |
398 | | - |
399 | | - |
| 398 | + |
400 | 399 | |
401 | | - |
| 400 | + |
| 401 | + |
| 402 | + |
| 403 | + |
| 404 | + |
402 | 405 | |
403 | 406 | |
| 407 | + |
| 408 | + |
| 409 | + |
| 410 | + |
| 411 | + |
| 412 | + |
| 413 | + |
| 414 | + |
| 415 | + |
404 | 416 | |
405 | 417 | |
406 | 418 | |
|
Collapse file
test/parallel/test-fs-readfile-tostring-fail.js
Copy file name to clipboard+52Lines changed: 52 additions & 0 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
| 1 | + |
| 2 | + |
| 3 | + |
| 4 | + |
| 5 | + |
| 6 | + |
| 7 | + |
| 8 | + |
| 9 | + |
| 10 | + |
| 11 | + |
| 12 | + |
| 13 | + |
| 14 | + |
| 15 | + |
| 16 | + |
| 17 | + |
| 18 | + |
| 19 | + |
| 20 | + |
| 21 | + |
| 22 | + |
| 23 | + |
| 24 | + |
| 25 | + |
| 26 | + |
| 27 | + |
| 28 | + |
| 29 | + |
| 30 | + |
| 31 | + |
| 32 | + |
| 33 | + |
| 34 | + |
| 35 | + |
| 36 | + |
| 37 | + |
| 38 | + |
| 39 | + |
| 40 | + |
| 41 | + |
| 42 | + |
| 43 | + |
| 44 | + |
| 45 | + |
| 46 | + |
| 47 | + |
| 48 | + |
| 49 | + |
| 50 | + |
| 51 | + |
| 52 | + |
0 commit comments