From a7869541e4401762a0b86c2a58f23482e6cb1cd1 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 4b3f762f80740c..b89135bbdcba59 100644 --- a/doc/api/buffer.md +++ b/doc/api/buffer.md @@ -684,6 +684,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