indexOfSequence
indexOfSequence(
haystack,needle,from?):number
Defined in: packages/core/src/buffer/index-of-sequence.ts:12
Index of the first occurrence of needle in haystack, or -1.
Uint8Array.prototype.indexOf only finds single bytes, so multi-byte
sequences (delimiters, magic numbers) need this.
Parameters
Section titled “Parameters”haystack
Section titled “haystack”Uint8Array
Bytes to search.
needle
Section titled “needle”Uint8Array
Sequence to find. An empty needle matches at from.
number = 0
Index to start searching at.
Returns
Section titled “Returns”number
The index of the first match, or -1.