MCPcopy Index your code
hub / github.com/simstudioai/sim / isValidPng

Function isValidPng

apps/sim/lib/uploads/utils/validation.ts:334–336  ·  view source on GitHub ↗
(buffer: Buffer)

Source from the content-addressed store, hash-verified

332 * Validate that a buffer contains valid PNG data by checking magic bytes
333 */
334export function isValidPng(buffer: Buffer): boolean {
335 return buffer.length >= 8 && buffer.subarray(0, 8).equals(PNG_MAGIC_BYTES)
336}
337
338/**
339 * Detect a renderable raster image from its leading bytes, returning the canonical MIME type or

Callers 1

sniffImageContentTypeFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected