(src: Uint8Array, dst: Uint8Array, offset = 0)
| 41 | * destination array. |
| 42 | */ |
| 43 | export function copy(src: Uint8Array, dst: Uint8Array, offset = 0): number { |
| 44 | offset = Math.max(0, Math.min(offset, dst.byteLength)); |
| 45 | const dstBytesAvailable = dst.byteLength - offset; |
| 46 | if (src.byteLength > dstBytesAvailable) { |
| 47 | src = src.subarray(0, dstBytesAvailable); |
| 48 | } |
| 49 | dst.set(src, offset); |
| 50 | return src.byteLength; |
| 51 | } |
no test coverage detected