doc: add notes about negative offsets in buffer.md

PR-URL: https://github.com/nodejs/node/pull/27030
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
pull/27037/head
Vse Mozhet Byt 2019-03-31 20:26:59 +03:00
parent 82a95fedc8
commit 2de67343a1
1 changed files with 7 additions and 4 deletions

View File

@ -1281,7 +1281,8 @@ added: v5.3.0
-->
* `value` {string|Buffer|Uint8Array|integer} What to search for.
* `byteOffset` {integer} Where to begin searching in `buf`. **Default:** `0`.
* `byteOffset` {integer} Where to begin searching in `buf`. If negative, then
offset is calculated from the end of `buf`. **Default:** `0`.
* `encoding` {string} If `value` is a string, this is its encoding.
**Default:** `'utf8'`.
* Returns: {boolean} `true` if `value` was found in `buf`, `false` otherwise.
@ -1321,7 +1322,8 @@ changes:
-->
* `value` {string|Buffer|Uint8Array|integer} What to search for.
* `byteOffset` {integer} Where to begin searching in `buf`. **Default:** `0`.
* `byteOffset` {integer} Where to begin searching in `buf`. If negative, then
offset is calculated from the end of `buf`. **Default:** `0`.
* `encoding` {string} If `value` is a string, this is the encoding used to
determine the binary representation of the string that will be searched for in
`buf`. **Default:** `'utf8'`.
@ -1423,8 +1425,9 @@ changes:
-->
* `value` {string|Buffer|Uint8Array|integer} What to search for.
* `byteOffset` {integer} Where to begin searching in `buf`.
**Default:** [`buf.length`]` - 1`.
* `byteOffset` {integer} Where to begin searching in `buf`. If negative, then
offset is calculated from the end of `buf`. **Default:**
[`buf.length`]` - 1`.
* `encoding` {string} If `value` is a string, this is the encoding used to
determine the binary representation of the string that will be searched for in
`buf`. **Default:** `'utf8'`.