From ee2ae0f30b0633defd4a32d2d4ff35d044b80b8a Mon Sep 17 00:00:00 2001 From: Vishal Bisht Date: Wed, 9 Aug 2017 16:16:14 -0400 Subject: [PATCH] doc: expanded description of buffer.slice MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Added description for the case when `end` is greater than buffer length PR-URL: https://github.com/nodejs/node/pull/14720 Fixes: https://github.com/nodejs/node/issues/14714 Reviewed-By: Rich Trott Reviewed-By: Benjamin Gruenbaum Reviewed-By: Refael Ackermann Reviewed-By: Tobias Nießen Reviewed-By: Colin Ihrig Reviewed-By: Luigi Pinca --- doc/api/buffer.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/doc/api/buffer.md b/doc/api/buffer.md index f8681c6be8e28e..4712957658df78 100644 --- a/doc/api/buffer.md +++ b/doc/api/buffer.md @@ -1907,6 +1907,9 @@ changes: Returns a new `Buffer` that references the same memory as the original, but offset and cropped by the `start` and `end` indices. +Specifying `end` greater than [`buf.length`] will return the same result as +that of `end` equal to [`buf.length`]. + *Note*: Modifying the new `Buffer` slice will modify the memory in the original `Buffer` because the allocated memory of the two objects overlap.