MCPcopy Create free account
hub / github.com/bearlyai/OpenADE / hasPrefix

Function hasPrefix

projects/runtime-node/src/fileMetadata.ts:68–71  ·  view source on GitHub ↗
(sample: Uint8Array, prefix: number[])

Source from the content-addressed store, hash-verified

66const utf8Decoder = new TextDecoder("utf-8", { fatal: true })
67
68function hasPrefix(sample: Uint8Array, prefix: number[]): boolean {
69 if (sample.length < prefix.length) return false
70 return prefix.every((byte, index) => sample[index] === byte)
71}
72
73function asciiAt(sample: Uint8Array, start: number, length: number): string {
74 if (sample.length < start + length) return ""

Callers 1

mediaTypeFromMagicFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected