(sample: Uint8Array, start: number, length: number)
| 71 | } |
| 72 | |
| 73 | function asciiAt(sample: Uint8Array, start: number, length: number): string { |
| 74 | if (sample.length < start + length) return "" |
| 75 | return String.fromCharCode(...sample.subarray(start, start + length)) |
| 76 | } |
| 77 | |
| 78 | function mediaTypeFromMagic(sample: Uint8Array): string | null { |
| 79 | if (hasPrefix(sample, [0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a])) return "image/png" |
no outgoing calls
no test coverage detected