summaryrefslogtreecommitdiff
path: root/doc/api/buffer.md
diff options
context:
space:
mode:
authorNikolai Vavilov <vvnicholas@gmail.com>2017-02-10 15:30:51 +0200
committerNikolai Vavilov <vvnicholas@gmail.com>2017-03-28 11:25:55 +0300
commit01ffe30d1875cd4ccd17fc671f7438923e69dcd4 (patch)
tree0d3650fd8f53a3ba077ee6594f8a7885a4129091 /doc/api/buffer.md
parent642baf4699c3a973c073403a7f1a4c85e0197e81 (diff)
downloadandroid-node-v8-01ffe30d1875cd4ccd17fc671f7438923e69dcd4.tar.gz
android-node-v8-01ffe30d1875cd4ccd17fc671f7438923e69dcd4.tar.bz2
android-node-v8-01ffe30d1875cd4ccd17fc671f7438923e69dcd4.zip
doc: clarify out-of-bounds behavior of buf[index]
PR-URL: https://github.com/nodejs/node/pull/11286 Fixes: https://github.com/nodejs/node/issues/11244 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Ron Korving <ron@ronkorving.nl>
Diffstat (limited to 'doc/api/buffer.md')
-rw-r--r--doc/api/buffer.md4
1 files changed, 4 insertions, 0 deletions
diff --git a/doc/api/buffer.md b/doc/api/buffer.md
index 1e564bfafe..6f84a31d0f 100644
--- a/doc/api/buffer.md
+++ b/doc/api/buffer.md
@@ -947,6 +947,10 @@ The index operator `[index]` can be used to get and set the octet at position
`index` in `buf`. The values refer to individual bytes, so the legal value
range is between `0x00` and `0xFF` (hex) or `0` and `255` (decimal).
+This operator is inherited from `Uint8Array`, so its behavior on out-of-bounds
+access is the same as `UInt8Array` - that is, getting returns `undefined` and
+setting does nothing.
+
Example: Copy an ASCII string into a `Buffer`, one byte at a time
```js