module

MJ::ImageSniff

What kind of image is this, from its first bytes.

Needed because callers hand us whatever they have — DataDungeon stores webp, the prop pipeline produces png, a phone photo is jpeg — and both providers want a truthful content type. upload_image_bytes used to label every reference data:image/png regardless of content; Runware tolerated it because it sniffs the body itself and ignores the label, so this was luck rather than correctness.

Class methods

extension(bytes : Bytes) : String
Source
gif?(b : Bytes) : Bool
Source
jpeg?(b : Bytes) : Bool
Source
kind(bytes : Bytes) : Tuple(String, String)

{extension, mime}. Defaults to png, which is what every provider accepts and what this codebase produces by default.

Source
mime(bytes : Bytes) : String
Source
png?(b : Bytes) : Bool
Source
webp?(b : Bytes) : Bool
Source