From 9861ec93d4b5420eb48b9169f1bec16b052354bf 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 19a82a72c803dd..b5c1e9895d1fdc 100644 --- a/doc/api/buffer.md +++ b/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