From 446bdb60899d761d5c4d5d1bf53affc7278f54d4 Mon Sep 17 00:00:00 2001 From: Darshan Sen Date: Wed, 27 Jan 2021 18:53:03 +0530 Subject: [PATCH] fs: change default value of position in read and readSync Since the docs mention that `position` in `read` and `readSync` should be an `integer` or a `bigint`, the functions should rather accept what is actually fed into `read`, i.e., `-1` instead of any nullish value. --- doc/api/fs.md | 12 ++++++++--- lib/fs.js | 22 ++++++++++++++++---- test/parallel/test-fs-promisified.js | 2 +- test/parallel/test-fs-read-type.js | 30 +++++++++++++++++++++++++++- test/parallel/test-fs-readfile-fd.js | 2 +- 5 files changed, 58 insertions(+), 10 deletions(-) diff --git a/doc/api/fs.md b/doc/api/fs.md index e11c057802e763..6b8e65e1739d4a 100644 --- a/doc/api/fs.md +++ b/doc/api/fs.md @@ -2704,6 +2704,9 @@ directory and subsequent read operations.