astro-ghostcms/.pnpm-store/v3/files/d6/74075bc2156fc171ea80f0d3331...

20 lines
470 B
Plaintext

import { toUTF8String, readUInt32LE } from "./utils.js";
const KTX = {
validate: (input) => {
const signature = toUTF8String(input, 1, 7);
return ["KTX 11", "KTX 20"].includes(signature);
},
calculate: (input) => {
const type = input[5] === 49 ? "ktx" : "ktx2";
const offset = type === "ktx" ? 36 : 20;
return {
height: readUInt32LE(input, offset + 4),
width: readUInt32LE(input, offset),
type
};
}
};
export {
KTX
};