This commit is contained in:
2024-03-22 03:47:51 +05:30
parent 8bcf3d211e
commit 89819f6fe2
28440 changed files with 3211033 additions and 2 deletions

30
node_modules/image-size/dist/detector.js generated vendored Normal file
View File

@@ -0,0 +1,30 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.detector = void 0;
const index_1 = require("./types/index");
const keys = Object.keys(index_1.typeHandlers);
// This map helps avoid validating for every single image type
const firstBytes = {
0x38: 'psd',
0x42: 'bmp',
0x44: 'dds',
0x47: 'gif',
0x49: 'tiff',
0x4d: 'tiff',
0x52: 'webp',
0x69: 'icns',
0x89: 'png',
0xff: 'jpg',
};
function detector(input) {
const byte = input[0];
if (byte in firstBytes) {
const type = firstBytes[byte];
if (type && index_1.typeHandlers[type].validate(input)) {
return type;
}
}
const finder = (key) => index_1.typeHandlers[key].validate(input);
return keys.find(finder);
}
exports.detector = detector;