MCPcopy Index your code
hub / github.com/Effect-TS/effect / mergeUint8Arrays

Function mergeUint8Arrays

packages/rpc/src/RpcServer.ts:1085–1096  ·  view source on GitHub ↗
(arrays: Chunk.Chunk<Uint8Array>)

Source from the content-addressed store, hash-verified

1083})
1084
1085const mergeUint8Arrays = (arrays: Chunk.Chunk<Uint8Array>) => {
1086 if (arrays.length === 0) return new Uint8Array(0)
1087 if (arrays.length === 1) return Chunk.unsafeHead(arrays)
1088 const length = Chunk.reduce(arrays, 0, (acc, a) => acc + a.length)
1089 const result = new Uint8Array(length)
1090 let offset = 0
1091 for (const array of arrays) {
1092 result.set(array, offset)
1093 offset += array.length
1094 }
1095 return result
1096}
1097
1098/**
1099 * @since 1.0.0

Callers 1

RpcServer.tsFile · 0.85

Calls 1

setMethod · 0.65

Tested by

no test coverage detected