Skip to content

Commit a786954

Browse files
cjihrigMylesBorins
authored andcommitted
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: #11845 Fixes: #11605 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Joyee Cheung <[email protected]> Reviewed-By: Luigi Pinca <[email protected]>
1 parent f43c969 commit a786954

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

doc/api/buffer.md

+4
Original file line numberDiff line numberDiff line change
@@ -684,6 +684,10 @@ in `list`. This however causes an additional loop to be executed in order to
684684
calculate the `totalLength`, so it is faster to provide the length explicitly if
685685
it is already known.
686686

687+
If `totalLength` is provided, it is coerced to an unsigned integer. If the
688+
combined length of the `Buffer`s in `list` exceeds `totalLength`, the result is
689+
truncated to `totalLength`.
690+
687691
Example: Create a single `Buffer` from a list of three `Buffer` instances
688692

689693
```js

0 commit comments

Comments
 (0)