diff options
author | cjihrig <cjihrig@gmail.com> | 2017-03-14 10:43:08 -0400 |
---|---|---|
committer | James M Snell <jasnell@gmail.com> | 2017-03-16 15:07:10 -0700 |
commit | db39273a8a21d78e074b363473031af894787f27 (patch) | |
tree | 13a24c4a23bd7a24adcf4651d1c75a75c80d6b3e /doc/api/buffer.md | |
parent | 5bfd13b81e38b60a7b9f346fbfcb216192cf0974 (diff) | |
download | android-node-v8-db39273a8a21d78e074b363473031af894787f27.tar.gz android-node-v8-db39273a8a21d78e074b363473031af894787f27.tar.bz2 android-node-v8-db39273a8a21d78e074b363473031af894787f27.zip |
doc: increase Buffer.concat() documentation
This commit adds documentation for two edge cases in
Buffer.concat(). Those cases are:
- totalLength is specified, but is not an integer.
- The combined buffer length is greater than totalLength.
PR-URL: https://github.com/nodejs/node/pull/11845
Fixes: https://github.com/nodejs/node/issues/11605
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Diffstat (limited to 'doc/api/buffer.md')
-rw-r--r-- | doc/api/buffer.md | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/doc/api/buffer.md b/doc/api/buffer.md index ddc17f28ca..1e564bfafe 100644 --- a/doc/api/buffer.md +++ b/doc/api/buffer.md @@ -755,6 +755,10 @@ in `list`. This however causes an additional loop to be executed in order to calculate the `totalLength`, so it is faster to provide the length explicitly if it is already known. +If `totalLength` is provided, it is coerced to an unsigned integer. If the +combined length of the `Buffer`s in `list` exceeds `totalLength`, the result is +truncated to `totalLength`. + Example: Create a single `Buffer` from a list of three `Buffer` instances ```js |