decord/source/4853_detectFile.js

107 lines
3.4 KiB
JavaScript
Raw Normal View History

2026-08-05 07:35:12 +00:00
// Module ID: 4853
// Function ID: 4854
2026-07-25 08:10:48 +00:00
// Name: detectFile
2026-08-05 07:35:12 +00:00
// Dependencies: [4854, 4855]
2026-07-25 08:10:48 +00:00
2026-08-05 07:35:12 +00:00
// Module 4853 (detectFile)
2026-07-25 08:10:48 +00:00
let require = arg1;
const dependencyMap = arg6;
arg5.detectFile = function detectFile(uint8Array, chunkSize) {
if (chunkSize) {
const _Object = Object;
2026-07-29 08:29:29 +00:00
const call = hasOwnProperty.call;
if (typeof call === "unknown") {
let hasOwnPropertyResult = hasOwnProperty("chunkSize");
} else {
hasOwnPropertyResult = call(chunkSize, "chunkSize");
}
if (hasOwnPropertyResult) {
2026-07-25 08:10:48 +00:00
chunkSize = undefined;
if (null != chunkSize) {
chunkSize = chunkSize.chunkSize;
}
let num2 = 0;
if (null !== chunkSize) {
num2 = 0;
if (undefined !== chunkSize) {
num2 = chunkSize;
}
}
if (num2 <= 0) {
const _RangeError = RangeError;
const rangeError = new RangeError("chunkSize must be bigger than zero");
throw rangeError;
}
}
}
let num3;
if (null != chunkSize) {
num3 = chunkSize.chunkSize;
}
if (!num3) {
num3 = 64;
}
2026-08-05 07:35:12 +00:00
const fileChunk = require(4854) /* getFileChunk */.getFileChunk(uint8Array, num3);
2026-07-25 08:10:48 +00:00
if (0 !== fileChunk.length) {
const items = [];
const items1 = [];
2026-08-05 07:35:12 +00:00
for (const key10027 in require(4855).FileTypes) {
2026-07-29 08:29:29 +00:00
let tmp22 = key10027;
2026-07-25 08:10:48 +00:00
let _Object4 = Object;
2026-07-29 08:29:29 +00:00
let call2 = hasOwnProperty2.call;
let tmp23 = require;
let tmp24 = dependencyMap;
2026-08-05 07:35:12 +00:00
let FileTypes5 = require(4855).FileTypes;
2026-07-29 08:29:29 +00:00
if (typeof call2 === "unknown") {
let hasOwnProperty2Result = hasOwnProperty2(key10027);
} else {
hasOwnProperty2Result = call2(FileTypes5, key10027);
}
if (!hasOwnProperty2Result) {
2026-07-25 08:10:48 +00:00
continue;
} else {
2026-08-05 07:35:12 +00:00
let FileTypes = tmp23(4855).FileTypes;
2026-07-25 08:10:48 +00:00
let signaturesByName = FileTypes.getSignaturesByName(key10027);
2026-08-05 07:35:12 +00:00
let FileTypes2 = tmp23(4855).FileTypes;
2026-07-25 08:10:48 +00:00
let detectbBySignaturesResult = FileTypes2.detectbBySignatures(fileChunk, signaturesByName);
if (!detectbBySignaturesResult) {
continue;
} else {
2026-08-05 07:35:12 +00:00
let FileTypes3 = tmp23(4855).FileTypes;
2026-07-25 08:10:48 +00:00
let infoByName = FileTypes3.getInfoByName(key10027);
2026-08-05 07:35:12 +00:00
let FILE_TYPES_REQUIRED_ADDITIONAL_CHECK = tmp23(4855).FILE_TYPES_REQUIRED_ADDITIONAL_CHECK;
2026-07-25 08:10:48 +00:00
if (FILE_TYPES_REQUIRED_ADDITIONAL_CHECK.includes(infoByName.extension)) {
let arr = items1.push(infoByName.extension);
}
2026-07-29 08:29:29 +00:00
let obj = { extension: null, mimeType: null, description: null, signature: null };
({ extension: obj[0], mimeType: obj[1], description: obj[2] } = infoByName);
2026-07-25 08:10:48 +00:00
let _Object2 = Object;
let _Object3 = Object;
2026-07-29 08:29:29 +00:00
obj = { sequence: null };
2026-07-25 08:10:48 +00:00
let sequence = detectbBySignaturesResult.sequence;
let merged = Object.assign({}, detectbBySignaturesResult);
2026-07-29 08:29:29 +00:00
obj[0] = sequence.map((arg0) => arg0.toString(16));
obj[3] = Object.assign(merged, obj);
2026-07-25 08:10:48 +00:00
arr = items.push(obj);
continue;
}
continue;
}
continue;
}
if (0 !== items.length) {
if (1 === items.length) {
if (0 === items1.length) {
return items[0];
}
}
2026-08-05 07:35:12 +00:00
const FileTypes4 = require(4855).FileTypes;
2026-07-25 08:10:48 +00:00
const result = FileTypes4.detectTypeByAdditionalCheck(fileChunk, items);
require = result;
if (result) {
return items.find((extension) => extension.extension === closure_0);
}
}
}
};