fs: nullish coalescing to respect zero positional reads · nodejs/node@fc328f1 · GitHub
Skip to content

Commit fc328f1

Browse files
mihilmyrichardlau
authored andcommitted
fs: nullish coalescing to respect zero positional reads
When the file read position is moved passing zero is not respected and `null` is used instead. PR fixes the issues by using nullish coalescing which will return the rhs only when the lhs is `null` or `undefined`; respecting the zero. Fixes: #40715 PR-URL: #40716 Fixes: #40699 Reviewed-By: Robert Nagy <ronagy@icloud.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: Evan Lucas <evanlucas@me.com>
1 parent 0231ffa commit fc328f1

2 files changed

Lines changed: 20 additions & 1 deletion

File tree

lib/internal/fs/promises.js

Lines changed: 1 addition & 1 deletion

test/parallel/test-fs-promises-file-handle-read.js

Lines changed: 19 additions & 0 deletions

0 commit comments

Comments
 (0)