Browse Source

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>
v7.x
cjihrig 8 years ago
committed by Italo A. Casas
parent
commit
9861ec93d4
No known key found for this signature in database GPG Key ID: 23EFEFE93C4CFFFE
  1. 4
      doc/api/buffer.md

4
doc/api/buffer.md

@ -747,6 +747,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

Loading…
Cancel
Save