(chunks: ReadonlyArray<Uint8Array>)
| 1236 | * `socket.write`. Every byte is initialized before the buffer is returned. |
| 1237 | */ |
| 1238 | const concat = (chunks: ReadonlyArray<Uint8Array>): Uint8Array => { |
| 1239 | let length = 0 |
| 1240 | for (let index = 0; index < chunks.length; index++) length += chunks[index].length |
| 1241 | const output = Buffer.allocUnsafe(length) |
| 1242 | let offset = 0 |
| 1243 | for (let index = 0; index < chunks.length; index++) { |
| 1244 | output.set(chunks[index], offset) |
| 1245 | offset += chunks[index].length |
| 1246 | } |
| 1247 | return output |
| 1248 | } |
| 1249 | |
| 1250 | const emptyParams: ReadonlyArray<unknown> = [] |
| 1251 |
no test coverage detected