Skip to content

Commit db39273

Browse files
cjihrigjasnell
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 5bfd13b commit db39273

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
@@ -755,6 +755,10 @@ in `list`. This however causes an additional loop to be executed in order to
755755
calculate the `totalLength`, so it is faster to provide the length explicitly if
756756
it is already known.
757757

758+
If `totalLength` is provided, it is coerced to an unsigned integer. If the
759+
combined length of the `Buffer`s in `list` exceeds `totalLength`, the result is
760+
truncated to `totalLength`.
761+
758762
Example: Create a single `Buffer` from a list of three `Buffer` instances
759763

760764
```js

0 commit comments

Comments
 (0)