-
-
Couldn't load subscription status.
- Fork 33.6k
Open
Description
Line 1042 in 2bda7cb
| If `totalLength` is provided, it is coerced to an unsigned integer. If the |
This is not what happens. Instead, non-integers throw:
> Buffer.concat([Buffer.of()],2.6)
Uncaught:
RangeError [ERR_OUT_OF_RANGE]: The value of "length" is out of range. It must be an integer. Received 2.6
at validateOffset (node:buffer:123:3)
at Buffer.concat (node:buffer:590:5) {
code: 'ERR_OUT_OF_RANGE'
}
> Buffer.concat([Buffer.of()],'10')
Uncaught:
TypeError [ERR_INVALID_ARG_TYPE]: The "length" argument must be of type number. Received type string ('10')
at validateOffset (node:buffer:123:3)
at Buffer.concat (node:buffer:590:5) {
code: 'ERR_INVALID_ARG_TYPE'
}
Less significant, but also confusing (ref: #55562)
Lines 1044 to 1045 in 2bda7cb
| truncated to `totalLength`. If the combined length of the `Buffer`s in `list` is | |
| less than `totalLength`, the remaining space is filled with zeros. |
This is not always true, as this happens on empty lists:
Lines 1036 to 1037 in 2bda7cb
| If the list has no items, or if the `totalLength` is 0, then a new zero-length | |
| `Buffer` is returned. |
> Buffer.concat([],100)
<Buffer >
Metadata
Metadata
Assignees
Labels
No labels