astro
Version:
Astro is a modern site builder with web best practices, performance, and DX front-of-mind.
25 lines (24 loc) • 531 B
JavaScript
import { typeHandlers, types } from "./types/index.js";
const firstBytes = /* @__PURE__ */ new Map([
[ ],
[ ],
[ ],
[ ],
[ ],
[ ],
[ ],
[ ],
[ ],
[ ]
]);
function detector(input) {
const byte = input[0];
const type = firstBytes.get(byte);
if (type && typeHandlers.get(type).validate(input)) {
return type;
}
return types.find((fileType) => typeHandlers.get(fileType).validate(input));
}
export {
detector
};