doc: expanded description of buffer.slice

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 <rtrott@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
This commit is contained in:
Vishal Bisht
2017-08-09 16:16:14 -04:00
committed by Refael Ackermann
parent 835c383969
commit 89d9cc789b

View File

@@ -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.