(buf: Buffer)
| 126 | } |
| 127 | |
| 128 | function crc32(buf: Buffer): number { |
| 129 | let crc = 0xffffffff; |
| 130 | for (let i = 0; i < buf.length; i++) { |
| 131 | crc ^= buf[i] ?? 0; |
| 132 | for (let bit = 0; bit < 8; bit++) { |
| 133 | const mask = -(crc & 1); |
| 134 | crc = (crc >>> 1) ^ (0xedb88320 & mask); |
| 135 | } |
| 136 | } |
| 137 | return (crc ^ 0xffffffff) >>> 0; |
| 138 | } |
| 139 | |
| 140 | export function extractPngMetadataFromBuffer(buf: Buffer): StillImageMetadata | null { |
| 141 | if ( |
no outgoing calls
no test coverage detected