From 75fa646f35c46df5a31554e9e3620a0f3a6e4979 Mon Sep 17 00:00:00 2001 From: dcharbonnier Date: Thu, 3 Aug 2017 19:37:09 +0200 Subject: [PATCH 1/2] doc: clarify the position argument for fs.read What happen to the file position after a read using a position null or integer was not clear and you can assume that the cursor of the file descriptor is updated even if position is an integer. Fixes: https://github.com/nodejs/node/issues/8397 --- doc/api/fs.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/doc/api/fs.md b/doc/api/fs.md index 6c8cbf42dc8d4e..c208a249598e9f 100644 --- a/doc/api/fs.md +++ b/doc/api/fs.md @@ -1640,7 +1640,9 @@ Read data from the file specified by `fd`. `length` is an integer specifying the number of bytes to read. `position` is an integer specifying where to begin reading from in the file. -If `position` is `null`, data will be read from the current file position. +If `position` is `null`, data will be read from the current file position, +and the file position will be updated for subsequent reads. +If `position` is an integer, the file position will remain unchanged. The callback is given the three arguments, `(err, bytesRead, buffer)`. From 93f39322f085dd8f5ff9c0cea09a8412309b8ad0 Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Fri, 4 Aug 2017 09:44:11 -0700 Subject: [PATCH 2/2] doc: improve fs.read() doc text --- doc/api/fs.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/doc/api/fs.md b/doc/api/fs.md index c208a249598e9f..db5509e4fd1593 100644 --- a/doc/api/fs.md +++ b/doc/api/fs.md @@ -1639,9 +1639,9 @@ Read data from the file specified by `fd`. `length` is an integer specifying the number of bytes to read. -`position` is an integer specifying where to begin reading from in the file. -If `position` is `null`, data will be read from the current file position, -and the file position will be updated for subsequent reads. +`position` is an argument specifying where to begin reading from in the file. +If `position` is `null`, data will be read from the current file position, +and the file position will be updated. If `position` is an integer, the file position will remain unchanged. The callback is given the three arguments, `(err, bytesRead, buffer)`.