From db39273a8a21d78e074b363473031af894787f27 Mon Sep 17 00:00:00 2001 From: cjihrig Date: Tue, 14 Mar 2017 10:43:08 -0400 Subject: [PATCH] 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 Reviewed-By: Joyee Cheung Reviewed-By: Luigi Pinca --- doc/api/buffer.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/doc/api/buffer.md b/doc/api/buffer.md index ddc17f28ca7f47..1e564bfafe566a 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