| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 403c50c commit 283ab61
2 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1054,7 +1054,7 @@ If the list has no items, or if the `totalLength` is 0, then a new zero-length | |||
| 1054 | 1054 | If `totalLength` is not provided, it is calculated from the `Buffer` instances | |
| 1055 | 1055 | in `list` by adding their lengths. | |
| 1056 | 1056 | ||
| 1057 | - If `totalLength` is provided, it is coerced to an unsigned integer. If the | ||
| 1057 | + If `totalLength` is provided, it must be an unsigned integer. If the | ||
| 1058 | 1058 | combined length of the `Buffer`s in `list` exceeds `totalLength`, the result is | |
| 1059 | 1059 | truncated to `totalLength`. If the combined length of the `Buffer`s in `list` is | |
| 1060 | 1060 | less than `totalLength`, the remaining space is filled with zeros. | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -72,6 +72,22 @@ assert.throws(() => { | |||
| 72 | 72 | 'or Uint8Array. Received type number (3)' | |
| 73 | 73 | }); | |
| 74 | 74 | ||
| 75 | + assert.throws(() => { | ||
| 76 | + Buffer.concat([Buffer.from('hello')], 3.5); | ||
| 77 | + }, { | ||
| 78 | + code: 'ERR_OUT_OF_RANGE', | ||
| 79 | + message: 'The value of "length" is out of range. It must be an integer. ' + | ||
| 80 | + 'Received 3.5' | ||
| 81 | + }); | ||
| 82 | + | ||
| 83 | + assert.throws(() => { | ||
| 84 | + Buffer.concat([Buffer.from('hello')], -2); | ||
| 85 | + }, { | ||
| 86 | + code: 'ERR_OUT_OF_RANGE', | ||
| 87 | + message: 'The value of "length" is out of range. It must be >= 0 && <= 9007199254740991. ' + | ||
| 88 | + 'Received -2' | ||
| 89 | + }); | ||
| 90 | + | ||
| 75 | 91 | // eslint-disable-next-line node-core/crypto-check | |
| 76 | 92 | const random10 = common.hasCrypto ? | |
| 77 | 93 | require('crypto').randomBytes(10) : | |
| Back | FazBrowse Home | New Git URL |
0 commit comments