Browse Source

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>
v6
Vishal Bisht 7 years ago
committed by Refael Ackermann
parent
commit
89d9cc789b
No known key found for this signature in database GPG Key ID: CD704BD80FDDDB64
  1. 3
      doc/api/buffer.md

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

Loading…
Cancel
Save