* Find the first occurrence of a byte sequence in a buffer.
(buf: Uint8Array, seq: number[])
| 271 | * Find the first occurrence of a byte sequence in a buffer. |
| 272 | */ |
| 273 | function findSequence(buf: Uint8Array, seq: number[]): number { |
| 274 | const end = buf.length - seq.length |
| 275 | for (let i = 0; i <= end; i++) { |
| 276 | if (matchesAt(buf, i, seq)) return i |
| 277 | } |
| 278 | return -1 |
| 279 | } |
| 280 | |
| 281 | /** |
| 282 | * Check if buffer matches a byte sequence at a given offset. |
no test coverage detected