diff options
Diffstat (limited to 'node_modules/magic-bytes.js/dist')
19 files changed, 966 insertions, 0 deletions
diff --git a/node_modules/magic-bytes.js/dist/create-snapshot.d.ts b/node_modules/magic-bytes.js/dist/create-snapshot.d.ts new file mode 100644 index 0000000..a73b3f0 --- /dev/null +++ b/node_modules/magic-bytes.js/dist/create-snapshot.d.ts @@ -0,0 +1,2 @@ +export {}; +//# sourceMappingURL=create-snapshot.d.ts.map
\ No newline at end of file diff --git a/node_modules/magic-bytes.js/dist/create-snapshot.d.ts.map b/node_modules/magic-bytes.js/dist/create-snapshot.d.ts.map new file mode 100644 index 0000000..a52325c --- /dev/null +++ b/node_modules/magic-bytes.js/dist/create-snapshot.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"create-snapshot.d.ts","sourceRoot":"","sources":["../src/create-snapshot.ts"],"names":[],"mappings":""}
\ No newline at end of file diff --git a/node_modules/magic-bytes.js/dist/create-snapshot.js b/node_modules/magic-bytes.js/dist/create-snapshot.js new file mode 100644 index 0000000..8060000 --- /dev/null +++ b/node_modules/magic-bytes.js/dist/create-snapshot.js @@ -0,0 +1,11 @@ +"use strict"; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +const pattern_tree_1 = __importDefault(require("./model/pattern-tree")); +require("fs") + .createWriteStream(__dirname + "/pattern-tree.snapshot.ts") + .write("// THIS FILE IS AUTOGENERATED. DO NOT EDIT\nexport default " + + JSON.stringify(pattern_tree_1.default()) + + "\n"); diff --git a/node_modules/magic-bytes.js/dist/index.d.ts b/node_modules/magic-bytes.js/dist/index.d.ts new file mode 100644 index 0000000..f910c52 --- /dev/null +++ b/node_modules/magic-bytes.js/dist/index.d.ts @@ -0,0 +1,7 @@ +import { GuessedFile } from "./model/tree"; +export declare const filetypeinfo: (bytes: number[] | Uint8Array | Uint8ClampedArray) => GuessedFile[]; +export default filetypeinfo; +export declare const filetypename: (bytes: number[] | Uint8Array | Uint8ClampedArray) => string[]; +export declare const filetypemime: (bytes: number[] | Uint8Array | Uint8ClampedArray) => string[]; +export declare const filetypeextension: (bytes: number[] | Uint8Array | Uint8ClampedArray) => string[]; +//# sourceMappingURL=index.d.ts.map
\ No newline at end of file diff --git a/node_modules/magic-bytes.js/dist/index.d.ts.map b/node_modules/magic-bytes.js/dist/index.d.ts.map new file mode 100644 index 0000000..241c4a1 --- /dev/null +++ b/node_modules/magic-bytes.js/dist/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAc,MAAM,cAAc,CAAC;AAIvD,eAAO,MAAM,YAAY,UAChB,MAAM,EAAE,GAAG,UAAU,GAAG,iBAAiB,KAC/C,WAAW,EAkBb,CAAC;AA0BF,eAAe,YAAY,CAAC;AAE5B,eAAO,MAAM,YAAY,UAAW,MAAM,EAAE,GAAG,UAAU,GAAG,iBAAiB,KAAG,MAAM,EAC1C,CAAC;AAC7C,eAAO,MAAM,YAAY,UAAW,MAAM,EAAE,GAAG,UAAU,GAAG,iBAAiB,KAAG,MAAM,EAC9B,CAAC;AACzD,eAAO,MAAM,iBAAiB,UAAW,MAAM,EAAE,GAAG,UAAU,GAAG,iBAAiB,KAAG,MAAM,EACzB,CAAC"}
\ No newline at end of file diff --git a/node_modules/magic-bytes.js/dist/index.js b/node_modules/magic-bytes.js/dist/index.js new file mode 100644 index 0000000..7bfde63 --- /dev/null +++ b/node_modules/magic-bytes.js/dist/index.js @@ -0,0 +1,56 @@ +"use strict"; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.filetypeextension = exports.filetypemime = exports.filetypename = exports.filetypeinfo = void 0; +const pattern_tree_1 = __importDefault(require("./model/pattern-tree")); +const toHex_1 = require("./model/toHex"); +const patternTree = pattern_tree_1.default(); +const filetypeinfo = (bytes) => { + let tree = patternTree; + for (const k of Object.keys(tree.offset)) { + const offset = toHex_1.fromHex(k); + const offsetExceedsFile = offset >= bytes.length; + if (offsetExceedsFile) { + continue; + } + const node = patternTree.offset[k]; + const guessed = walkTree(offset, bytes, node); + if (guessed.length > 0) { + return guessed; + } + } + if (tree.noOffset === null) { + return []; + } + return walkTree(0, bytes, tree.noOffset); +}; +exports.filetypeinfo = filetypeinfo; +const walkTree = (index, bytes, node) => { + let step = node; + let guessFile = []; + while (true) { + const currentByte = toHex_1.toHex(bytes[index]); + if (step.bytes["?"] && !step.bytes[currentByte]) { + step = step.bytes["?"]; + } + else { + step = step.bytes[currentByte]; + } + if (!step) { + return guessFile; + } + if (step && step.matches) { + guessFile = step.matches.slice(0); + } + index += 1; + } +}; +exports.default = exports.filetypeinfo; +const filetypename = (bytes) => exports.filetypeinfo(bytes).map((e) => e.typename); +exports.filetypename = filetypename; +const filetypemime = (bytes) => exports.filetypeinfo(bytes).map((e) => (e.mime ? e.mime : "")); +exports.filetypemime = filetypemime; +const filetypeextension = (bytes) => exports.filetypeinfo(bytes).map((e) => (e.extension ? e.extension : "")); +exports.filetypeextension = filetypeextension; diff --git a/node_modules/magic-bytes.js/dist/index.spec.d.ts b/node_modules/magic-bytes.js/dist/index.spec.d.ts new file mode 100644 index 0000000..b37c2d2 --- /dev/null +++ b/node_modules/magic-bytes.js/dist/index.spec.d.ts @@ -0,0 +1,2 @@ +export {}; +//# sourceMappingURL=index.spec.d.ts.map
\ No newline at end of file diff --git a/node_modules/magic-bytes.js/dist/index.spec.d.ts.map b/node_modules/magic-bytes.js/dist/index.spec.d.ts.map new file mode 100644 index 0000000..47bd666 --- /dev/null +++ b/node_modules/magic-bytes.js/dist/index.spec.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.spec.d.ts","sourceRoot":"","sources":["../src/index.spec.ts"],"names":[],"mappings":""}
\ No newline at end of file diff --git a/node_modules/magic-bytes.js/dist/model/pattern-tree.d.ts b/node_modules/magic-bytes.js/dist/model/pattern-tree.d.ts new file mode 100644 index 0000000..2e36330 --- /dev/null +++ b/node_modules/magic-bytes.js/dist/model/pattern-tree.d.ts @@ -0,0 +1,4 @@ +import { Tree } from "./tree"; +declare const _default: () => Tree; +export default _default; +//# sourceMappingURL=pattern-tree.d.ts.map
\ No newline at end of file diff --git a/node_modules/magic-bytes.js/dist/model/pattern-tree.d.ts.map b/node_modules/magic-bytes.js/dist/model/pattern-tree.d.ts.map new file mode 100644 index 0000000..f555632 --- /dev/null +++ b/node_modules/magic-bytes.js/dist/model/pattern-tree.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"pattern-tree.d.ts","sourceRoot":"","sources":["../../src/model/pattern-tree.ts"],"names":[],"mappings":"AACA,OAAO,EAA8C,IAAI,EAAE,MAAM,QAAQ,CAAC;8BAq3BvD,IAAI;AAAvB,wBAAwC"}
\ No newline at end of file diff --git a/node_modules/magic-bytes.js/dist/model/pattern-tree.js b/node_modules/magic-bytes.js/dist/model/pattern-tree.js new file mode 100644 index 0000000..68228fe --- /dev/null +++ b/node_modules/magic-bytes.js/dist/model/pattern-tree.js @@ -0,0 +1,764 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const toHex_1 = require("./toHex"); +const tree_1 = require("./tree"); +// https://en.wikipedia.org/wiki/List_of_file_signatures +let fileType = new Map(); +let tree = { + noOffset: null, + offset: {}, +}; +const add = (typename, signature, additionalInfo, offset) => { + fileType.set(typename, signature); + if (offset) { + const existing = tree.offset[toHex_1.toHex(offset)]; + if (!existing) { + tree.offset[toHex_1.toHex(offset)] = tree_1.createComplexNode(typename, signature.map((e) => e.toLowerCase()), additionalInfo); + } + else { + const merged = tree_1.merge(tree_1.createNode(typename, signature.map((e) => e.toLowerCase()), additionalInfo), { ...existing }); + tree.offset[toHex_1.toHex(offset)] = merged; + } + } + else { + if (tree.noOffset === null) { + tree.noOffset = tree_1.createComplexNode(typename, signature.map((e) => e.toLowerCase()), additionalInfo); + } + else { + tree.noOffset = tree_1.merge(tree_1.createNode(typename, signature.map((e) => e.toLowerCase()), additionalInfo), tree.noOffset); + } + } +}; +add("gif", ["0x47", "0x49", "0x46", "0x38", "0x37", "0x61"], { + mime: "image/gif", + extension: "gif", +}); +add("gif", ["0x47", "0x49", "0x46", "0x38", "0x39", "0x61"], { + mime: "image/gif", + extension: "gif", +}); +add("jpg", ["0xFF", "0xD8", "0xFF", "0xDB"], { + mime: "image/jpeg", + extension: "jpeg", +}); +add("jpg", [ + "0xFF", + "0xD8", + "0xFF", + "0xE0", + "?", + "?", + "0x4A", + "0x46", + "0x49", + "0x46", + "0x00", + "0x01", +], { mime: "image/jpeg", extension: "jpeg" }); +add("jpg", [ + "0xFF", + "0xD8", + "0xFF", + "0xE1", + "?", + "?", + "0x45", + "0x78", + "0x69", + "0x66", + "0x00", + "0x00", +], { mime: "image/jpeg", extension: "jpeg" }); +add("webp", [ + "0x52", + "0x49", + "0x46", + "0x46", + "?", + "?", + "?", + "?", + "0x57", + "0x45", + "0x42", + "0x50", +], { mime: "image/webp", extension: "webp" }); +add("heif", ["0x66", "0x74", "0x79", "0x70", "0x6D", "0x69", "0x66", "0x31"], { mime: "image/heif", extension: "heif" }, 4); +add("heif", ["0x66", "0x74", "0x79", "0x70", "0x68", "0x65", "0x69", "0x63"], { mime: "image/heif", extension: "heic" }, 4); +add("rpm", ["0xed", "0xab", "0xee", "0xdb"]); +add("bin", ["0x53", "0x50", "0x30", "0x31"], { + mime: "application/octet-stream", + extension: "bin", +}); +add("pic", ["0x00"]); +add("pif", ["0x00"]); +add("sea", ["0x00"]); +add("ytr", ["0x00"]); +// 66747970 +// 6D703432 +add("mp4", ["0x66", "0x74", "0x79", "0x70"], { mime: "video/mp4", extension: "mp4" }, 0x4); +add("pdb", [ + "0x00", + "0x00", + "0x00", + "0x00", + "0x00", + "0x00", + "0x00", + "0x00", + "0x00", + "0x00", + "0x00", + "0x00", + "0x00", + "0x00", + "0x00", + "0x00", + "0x00", + "0x00", + "0x00", + "0x00", + "0x00", + "0x00", + "0x00", + "0x00", +]); +add("dba", ["0xBE", "0xBA", "0xFE", "0xCA"]); +add("dba2", ["0x00", "0x01", "0x42", "0x44"]); +add("tda", ["0x00", "0x01", "0x44", "0x54"]); +add("tda2", ["0x00", "0x01", "0x00", "0x00"]); +add("ico", ["0x00", "0x00", "0x01", "0x00"], { + mime: "image/x-icon", + extension: "ico", +}); +add("3gp", ["0x66", "0x74", "0x79", "0x70", "0x33", "0x67"]); +add("z", ["0x1F", "0x9D"]); +add("tar.z", ["0x1F", "0xA0"]); +add("bac", [ + "0x42", + "0x41", + "0x43", + "0x4B", + "0x4D", + "0x49", + "0x4B", + "0x45", + "0x44", + "0x49", + "0x53", + "0x4B", +]); +add("bz2", ["0x42", "0x5A", "0x68"], { + mime: "application/x-bzip2", + extension: "bz2", +}); +add("tif", ["0x49", "0x49", "0x2A", "0x00"], { + mime: "image/tiff", + extension: "tif", +}); +add("tiff", ["0x4D", "0x4D", "0x00", "0x2A"], { + mime: "image/tiff", + extension: "tiff", +}); +add("cr2", [ + "0x49", + "0x49", + "0x2A", + "0x00", + "0x10", + "0x00", + "0x00", + "0x00", + "0x43", + "0x52", +]); +add("cin", ["0x80", "0x2A", "0x5F", "0xD7"]); +add("cin1", ["0x52", "0x4E", "0x43", "0x01"]); +add("cin2", ["0x52", "0x4E", "0x43", "0x02"]); +add("dpx", ["0x53", "0x44", "0x50", "0x58"]); +add("dpx2", ["0x58", "0x50", "0x44", "0x53"]); +add("exr", ["0x76", "0x2F", "0x31", "0x01"]); +add("bpg", ["0x42", "0x50", "0x47", "0xFB"]); +add("ilbm", [ + "0x46", + "0x4F", + "0x52", + "0x4D", + "?", + "?", + "?", + "?", + "0x49", + "0x4C", + "0x42", + "0x4D", +]); +add("8svx", [ + "0x46", + "0x4F", + "0x52", + "0x4D", + "?", + "?", + "?", + "?", + "0x38", + "0x53", + "0x56", + "0x58", +]); +add("acbm", [ + "0x46", + "0x4F", + "0x52", + "0x4D", + "?", + "?", + "?", + "?", + "0x41", + "0x43", + "0x42", + "0x4D", +]); +add("anbm", [ + "0x46", + "0x4F", + "0x52", + "0x4D", + "?", + "?", + "?", + "?", + "0x41", + "0x4E", + "0x42", + "0x4D", +]); +add("anim", [ + "0x46", + "0x4F", + "0x52", + "0x4D", + "?", + "?", + "?", + "?", + "0x41", + "0x4E", + "0x49", + "0x4D", +]); +add("faxx", [ + "0x46", + "0x4F", + "0x52", + "0x4D", + "?", + "?", + "?", + "?", + "0x46", + "0x41", + "0x58", + "0x58", +]); +add("ftxt", [ + "0x46", + "0x4F", + "0x52", + "0x4D", + "?", + "?", + "?", + "?", + "0x46", + "0x54", + "0x58", + "0x54", +]); +add("smus", [ + "0x46", + "0x4F", + "0x52", + "0x4D", + "?", + "?", + "?", + "?", + "0x53", + "0x4D", + "0x55", + "0x53", +]); +add("cmus", [ + "0x46", + "0x4F", + "0x52", + "0x4D", + "?", + "?", + "?", + "?", + "0x43", + "0x4D", + "0x55", + "0x53", +]); +add("yuvn", [ + "0x46", + "0x4F", + "0x52", + "0x4D", + "?", + "?", + "?", + "?", + "0x59", + "0x55", + "0x56", + "0x4E", +]); +add("iff", [ + "0x46", + "0x4F", + "0x52", + "0x4D", + "?", + "?", + "?", + "?", + "0x46", + "0x41", + "0x4E", + "0x54", +]); +add("aiff", [ + "0x46", + "0x4F", + "0x52", + "0x4D", + "?", + "?", + "?", + "?", + "0x41", + "0x49", + "0x46", + "0x46", +], { mime: "audio/x-aiff", extension: "aiff" }); +add("idx", ["0x49", "0x4E", "0x44", "0x58"]); +add("lz", ["0x4C", "0x5A", "0x49", "0x50"]); +add("exe", ["0x4D", "0x5A"]); +add("zip", ["0x50", "0x4B", "0x03", "0x04"], { + mime: "application/zip", + extension: "zip", +}); +add("zip", ["0x50", "0x4B", "0x05", "0x06"], { + mime: "application/zip", + extension: "zip", +}); +add("zip", ["0x50", "0x4B", "0x07", "0x08"], { + mime: "application/zip", + extension: "zip", +}); +add("jar", ["0x50", "0x4B", "0x03", "0x04"], { + mime: "application/java-archive", + extension: "jar", +}); +add("jar", ["0x50", "0x4B", "0x05", "0x06"], { + mime: "application/java-archive", + extension: "jar", +}); +add("jar", ["0x50", "0x4B", "0x07", "0x08"], { + mime: "application/java-archive", + extension: "jar", +}); +add("odt", ["0x50", "0x4B", "0x03", "0x04"], { + mime: "application/vnd.oasis.opendocument.text", + extension: "odt", +}); +add("odt", ["0x50", "0x4B", "0x05", "0x06"], { + mime: "application/vnd.oasis.opendocument.text", + extension: "odt", +}); +add("odt", ["0x50", "0x4B", "0x07", "0x08"], { + mime: "application/vnd.oasis.opendocument.text", + extension: "odt", +}); +add("ods", ["0x50", "0x4B", "0x03", "0x04"], { + mime: "application/vnd.oasis.opendocument.spreadsheet", + extension: "ods", +}); +add("ods", ["0x50", "0x4B", "0x05", "0x06"], { + mime: "application/vnd.oasis.opendocument.spreadsheet", + extension: "ods", +}); +add("ods", ["0x50", "0x4B", "0x07", "0x08"], { + mime: "application/vnd.oasis.opendocument.spreadsheet", + extension: "ods", +}); +add("odp", ["0x50", "0x4B", "0x03", "0x04"], { + mime: "application/vnd.oasis.opendocument.presentation", + extension: "odp", +}); +add("odp", ["0x50", "0x4B", "0x05", "0x06"], { + mime: "application/vnd.oasis.opendocument.presentation", + extension: "odp", +}); +add("odp", ["0x50", "0x4B", "0x07", "0x08"], { + mime: "application/vnd.oasis.opendocument.presentation", + extension: "odp", +}); +add("docx", ["0x50", "0x4B", "0x03", "0x04"], { + mime: "application/vnd.openxmlformats-officedocument.wordprocessingml.document", + extension: "docx", +}); +add("docx", ["0x50", "0x4B", "0x05", "0x06"], { + mime: "application/vnd.openxmlformats-officedocument.wordprocessingml.document", + extension: "docx", +}); +add("docx", ["0x50", "0x4B", "0x07", "0x08"], { + mime: "application/vnd.openxmlformats-officedocument.wordprocessingml.document", + extension: "docx", +}); +add("xlsx", ["0x50", "0x4B", "0x03", "0x04"], { + mime: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", + extension: "xlsx", +}); +add("xlsx", ["0x50", "0x4B", "0x05", "0x06"], { + mime: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", + extension: "xlsx", +}); +add("xlsx", ["0x50", "0x4B", "0x07", "0x08"], { + mime: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", + extension: "xlsx", +}); +add("pptx", ["0x50", "0x4B", "0x03", "0x04"], { + mime: "application/vnd.openxmlformats-officedocument.presentationml.presentation", + extension: "pptx", +}); +add("pptx", ["0x50", "0x4B", "0x05", "0x06"], { + mime: "application/vnd.openxmlformats-officedocument.presentationml.presentation", + extension: "pptx", +}); +add("pptx", ["0x50", "0x4B", "0x07", "0x08"], { + mime: "application/vnd.openxmlformats-officedocument.presentationml.presentation", + extension: "pptx", +}); +add("vsdx", ["0x50", "0x4B", "0x03", "0x04"]); +add("vsdx", ["0x50", "0x4B", "0x05", "0x06"]); +add("vsdx", ["0x50", "0x4B", "0x07", "0x08"]); +add("apk", ["0x50", "0x4B", "0x03", "0x04"]); +add("apk", ["0x50", "0x4B", "0x05", "0x06"]); +add("apk", ["0x50", "0x4B", "0x07", "0x08"]); +add("aar", ["0x50", "0x4B", "0x03", "0x04"]); +add("aar", ["0x50", "0x4B", "0x05", "0x06"]); +add("aar", ["0x50", "0x4B", "0x07", "0x08"]); +add("rar", ["0x52", "0x61", "0x72", "0x21", "0x1A", "0x07", "0x00"], { + mime: "application/vnd.rar", + extension: "rar", +}); +add("rar", ["0x52", "0x61", "0x72", "0x21", "0x1A", "0x07", "0x01", "0x00"], { + mime: "application/vnd.rar", + extension: "rar", +}); +add("rar", ["0x7F", "0x45", "0x4C", "0x46"], { + mime: "application/vnd.rar", + extension: "rar", +}); +add("png", ["0x89", "0x50", "0x4E", "0x47", "0x0D", "0x0A", "0x1A", "0x0A"], { + mime: "image/png", + extension: "png", +}); +add("apng", ["0x89", "0x50", "0x4E", "0x47", "0x0D", "0x0A", "0x1A", "0x0A"], { + mime: "image/apng", + extension: "apng", +}); +add("class", ["0xCA", "0xFE", "0xBA", "0xBE"]); +add("class", ["0xEF", "0xBB", "0xBF"]); +add("class", ["0xFE", "0xed", "0xFA", "0xCE"], undefined, 0x1000); +add("class", ["0xFE", "0xed", "0xFA", "0xCF"], undefined, 0x1000); +add("class", ["0xCE", "0xFA", "0xed", "0xFE"]); +add("class", ["0xCF", "0xFA", "0xed", "0xFE"]); +add("class", ["0xFF", "0xFE"]); +add("class", ["0xFF", "0xFE"]); +add("class", ["0xFF", "0xFE", "0x00", "0x00"]); +add("ps", ["0x25", "0x21", "0x50", "0x53"]); +add("pdf", ["0x25", "0x50", "0x44", "0x46"], { + mime: "application/pdf", + extension: "pdf", +}); +add("asf", [ + "0x30", + "0x26", + "0xB2", + "0x75", + "0x8E", + "0x66", + "0xCF", + "0x11", + "0xA6", + "0xD9", + "0x00", + "0xAA", + "0x00", + "0x62", + "0xCE", + "0x6C", +]); +add("wma", [ + "0x30", + "0x26", + "0xB2", + "0x75", + "0x8E", + "0x66", + "0xCF", + "0x11", + "0xA6", + "0xD9", + "0x00", + "0xAA", + "0x00", + "0x62", + "0xCE", + "0x6C", +]); +add("wmv", [ + "0x30", + "0x26", + "0xB2", + "0x75", + "0x8E", + "0x66", + "0xCF", + "0x11", + "0xA6", + "0xD9", + "0x00", + "0xAA", + "0x00", + "0x62", + "0xCE", + "0x6C", +]); +add("deploymentimage", [ + "0x24", + "0x53", + "0x44", + "0x49", + "0x30", + "0x30", + "0x30", + "0x31", +]); +add("ogg", ["0x4F", "0x67", "0x67", "0x53"], { + mime: "audio/ogg", + extension: "ogg", +}); +add("oga", ["0x4F", "0x67", "0x67", "0x53"], { + mime: "audio/ogg", + extension: "oga", +}); +add("ogv", ["0x4F", "0x67", "0x67", "0x53"], { + mime: "video/ogg", + extension: "ogv", +}); +add("psd", ["0x38", "0x42", "0x50", "0x53"], { + mime: "application/x-photoshop", + extension: "psd", +}); +add("clip", ["0x43", "0x53", "0x46", "0x43", "0x48", "0x55", "0x4e", "0x4b"]); +add("wav", [ + "0x52", + "0x49", + "0x46", + "0x46", + "?", + "?", + "?", + "?", + "0x57", + "0x41", + "0x56", + "0x45", +], { mime: "audio/x-wav", extension: "wav" }); +add("avi", [ + "0x52", + "0x49", + "0x46", + "0x46", + "?", + "?", + "?", + "?", + "0x41", + "0x56", + "0x49", + "0x20", +], { mime: "video/x-msvideo", extension: "avi" }); +add("mp3", ["0xFF", "0xFB"], { mime: "audio/mpeg", extension: "mp3" }); +add("mp3", ["0xFF", "0xF3"], { mime: "audio/mpeg", extension: "mp3" }); +add("mp3", ["0xFF", "0xF2"], { mime: "audio/mpeg", extension: "mp3" }); +add("mp3", ["0x49", "0x44", "0x33"], { mime: "audio/mpeg", extension: "mp3" }); +add("bmp", ["0x42", "0x4D"], { mime: "image/bmp", extension: "bmp" }); +add("iso", ["0x43", "0x44", "0x30", "0x30", "0x31"]); +add("flac", ["0x66", "0x4C", "0x61", "0x43"]); +add("mid", ["0x4D", "0x54", "0x68", "0x64"], { + mime: "audio/midi", + extension: "mid", +}); +add("midi", ["0x4D", "0x54", "0x68", "0x64"], { + mime: "audio/midi", + extension: "midi", +}); +add("doc", ["0xD0", "0xCF", "0x11", "0xE0", "0xA1", "0xB1", "0x1A", "0xE1"], { + mime: "application/msword", + extension: "doc", +}); +add("xls", ["0xD0", "0xCF", "0x11", "0xE0", "0xA1", "0xB1", "0x1A", "0xE1"], { + mime: "application/vnd.ms-excel", + extension: "xls", +}); +add("ppt", ["0xD0", "0xCF", "0x11", "0xE0", "0xA1", "0xB1", "0x1A", "0xE1"], { + mime: "application/vnd.ms-powerpoint", + extension: "ppt", +}); +add("msg", ["0xD0", "0xCF", "0x11", "0xE0", "0xA1", "0xB1", "0x1A", "0xE1"]); +add("dex", ["0x64", "0x65", "0x78", "0x0A", "0x30", "0x33", "0x35", "0x00"]); +add("vmdk", ["0x4B", "0x44", "0x4D"]); +add("crx", ["0x43", "0x72", "0x32", "0x34"]); +add("fh8", ["0x41", "0x47", "0x44", "0x33"]); +add("cwk", [ + "0x05", + "0x07", + "0x00", + "0x00", + "0x42", + "0x4F", + "0x42", + "0x4F", + "0x05", + "0x07", + "0x00", + "0x00", + "0x00", + "0x00", + "0x00", + "0x00", + "0x00", + "0x00", + "0x00", + "0x00", + "0x00", + "0x01", +]); +add("cwk", [ + "0x06", + "0x07", + "0xE1", + "0x00", + "0x42", + "0x4F", + "0x42", + "0x4F", + "0x06", + "0x07", + "0xE1", + "0x00", + "0x00", + "0x00", + "0x00", + "0x00", + "0x00", + "0x00", + "0x00", + "0x00", + "0x00", + "0x01", +]); +add("toast", ["0x45", "0x52", "0x02", "0x00", "0x00", "0x00"]); +add("toast", ["0x8B", "0x45", "0x52", "0x02", "0x00", "0x00", "0x00"]); +add("dmg", ["0x78", "0x01", "0x73", "0x0D", "0x62", "0x62", "0x60"]); +add("xar", ["0x78", "0x61", "0x72", "0x21"]); +add("dat", ["0x50", "0x4D", "0x4F", "0x43", "0x43", "0x4D", "0x4F", "0x43"]); +add("nes", ["0x4E", "0x45", "0x53", "0x1A"]); +add("tar", ["0x75", "0x73", "0x74", "0x61", "0x72", "0x00", "0x30", "0x30"], undefined, 0x101); +add("tar", ["0x75", "0x73", "0x74", "0x61", "0x72", "0x20", "0x20", "0x00"], undefined, 0x101); +add("tox", ["0x74", "0x6F", "0x78", "0x33"]); +add("mlv", ["0x4D", "0x4C", "0x56", "0x49"]); +add("windowsupdate", [ + "0x44", + "0x43", + "0x4D", + "0x01", + "0x50", + "0x41", + "0x33", + "0x30", +]); +add("7z", ["0x37", "0x7A", "0xBC", "0xAF", "0x27", "0x1C"], { + mime: "application/x-7z-compressed", + extension: "7z", +}); +add("gz", ["0x1F", "0x8B"], { mime: "application/gzip", extension: "gz" }); +add("tar.gz", ["0x1F", "0x8B"], { + mime: "application/gzip", + extension: "tar.gz", +}); +add("xz", ["0xFD", "0x37", "0x7A", "0x58", "0x5A", "0x00", "0x00"], { + mime: "application/gzip", + extension: "xz", +}); +add("tar.xz", ["0xFD", "0x37", "0x7A", "0x58", "0x5A", "0x00", "0x00"], { + mime: "application/gzip", + extension: "tar.xz", +}); +add("lz2", ["0x04", "0x22", "0x4D", "0x18"]); +add("cab", ["0x4D", "0x53", "0x43", "0x46"]); +add("mkv", ["0x1A", "0x45", "0xDF", "0xA3"]); +add("mka", ["0x1A", "0x45", "0xDF", "0xA3"]); +add("mks", ["0x1A", "0x45", "0xDF", "0xA3"]); +add("mk3d", ["0x1A", "0x45", "0xDF", "0xA3"]); +add("webm", ["0x1A", "0x45", "0xDF", "0xA3"], { + mime: "audio/webm", + extension: "webm", +}); +add("dcm", ["0x44", "0x49", "0x43", "0x4D"], undefined, 0x80); +add("xml", ["0x3C", "0x3f", "0x78", "0x6d", "0x6C", "0x20"], { + mime: "application/xml", + extension: "xml", +}); +add("wasm", ["0x00", "0x61", "0x73", "0x6d"]); +add("lep", ["0xCF", "0x84", "0x01"]); +add("swf", ["0x43", "0x57", "0x53"], { + mime: "application/x-shockwave-flash", + extension: "swf", +}); +add("swf", ["0x46", "0x57", "0x53"], { + mime: "application/x-shockwave-flash", + extension: "swf", +}); +add("deb", ["0x21", "0x3C", "0x61", "0x72", "0x63", "0x68", "0x3E"]); +add("rtf", ["0x7B", "0x5C", "0x72", "0x74", "0x66", "0x31"], { + mime: "application/rtf", + extension: "rtf", +}); +add("m2p", ["0x00", "0x00", "0x01", "0xBA"]); +add("vob", ["0x00", "0x00", "0x01", "0xBA"]); +add("mpg", ["0x00", "0x00", "0x01", "0xBA"], { + mime: "video/mpeg", + extension: "mpg", +}); +add("mpeg", ["0x00", "0x00", "0x01", "0xBA"], { + mime: "video/mpeg", + extension: "mpeg", +}); +add("mpeg", ["0x47"], { mime: "video/mpeg", extension: "mpeg" }); +add("mpeg", ["0x00", "0x00", "0x01", "0xB3"], { + mime: "video/mpeg", + extension: "mpeg", +}); +add("hl2demo", ["48", "4C", "32", "44", "45", "4D", "4F"]); +exports.default = () => tree; diff --git a/node_modules/magic-bytes.js/dist/model/toHex.d.ts b/node_modules/magic-bytes.js/dist/model/toHex.d.ts new file mode 100644 index 0000000..a751029 --- /dev/null +++ b/node_modules/magic-bytes.js/dist/model/toHex.d.ts @@ -0,0 +1,3 @@ +export declare const toHex: (num: number) => string; +export declare const fromHex: (hex: string) => number; +//# sourceMappingURL=toHex.d.ts.map
\ No newline at end of file diff --git a/node_modules/magic-bytes.js/dist/model/toHex.d.ts.map b/node_modules/magic-bytes.js/dist/model/toHex.d.ts.map new file mode 100644 index 0000000..b8b408a --- /dev/null +++ b/node_modules/magic-bytes.js/dist/model/toHex.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"toHex.d.ts","sourceRoot":"","sources":["../../src/model/toHex.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,KAAK,QAAS,MAAM,KAAG,MACsB,CAAC;AAC3D,eAAO,MAAM,OAAO,QAAS,MAAM,WAA8B,CAAC"}
\ No newline at end of file diff --git a/node_modules/magic-bytes.js/dist/model/toHex.js b/node_modules/magic-bytes.js/dist/model/toHex.js new file mode 100644 index 0000000..9e38713 --- /dev/null +++ b/node_modules/magic-bytes.js/dist/model/toHex.js @@ -0,0 +1,8 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.fromHex = exports.toHex = void 0; +const hex = (num) => new Number(num).toString(16).toLowerCase(); +const toHex = (num) => `0x${hex(num).length === 1 ? "0" + hex(num) : hex(num)}`; +exports.toHex = toHex; +const fromHex = (hex) => new Number(hex); +exports.fromHex = fromHex; diff --git a/node_modules/magic-bytes.js/dist/model/tree.d.ts b/node_modules/magic-bytes.js/dist/model/tree.d.ts new file mode 100644 index 0000000..47f3e14 --- /dev/null +++ b/node_modules/magic-bytes.js/dist/model/tree.d.ts @@ -0,0 +1,30 @@ +export declare type PathlessNewNode = { + info: Info; + typename: string; +}; +export declare type NewNode = PathlessNewNode & { + bytes: string[]; +}; +export declare type GuessedFile = Info & { + typename: string; +}; +export declare type Info = { + mime?: string; + extension?: string; +}; +export declare type Node = { + matches?: GuessedFile[]; + bytes: { + [nextbyte: string]: Node; + }; +}; +export declare type Tree = { + noOffset: Node | null; + offset: { + [offsetByte: string]: Node; + }; +}; +export declare const merge: (node: NewNode, tree: Node) => Node; +export declare const createNode: (typename: string, bytes: string[], info?: Info | undefined) => NewNode; +export declare const createComplexNode: (typename: string, bytes: string[], info?: Info | undefined) => Node; +//# sourceMappingURL=tree.d.ts.map
\ No newline at end of file diff --git a/node_modules/magic-bytes.js/dist/model/tree.d.ts.map b/node_modules/magic-bytes.js/dist/model/tree.d.ts.map new file mode 100644 index 0000000..38b2f0f --- /dev/null +++ b/node_modules/magic-bytes.js/dist/model/tree.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"tree.d.ts","sourceRoot":"","sources":["../../src/model/tree.ts"],"names":[],"mappings":"AAAA,oBAAY,eAAe,GAAG;IAC5B,IAAI,EAAE,IAAI,CAAC;IACX,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,oBAAY,OAAO,GAAG,eAAe,GAAG;IACtC,KAAK,EAAE,MAAM,EAAE,CAAC;CACjB,CAAC;AAEF,oBAAY,WAAW,GAAG,IAAI,GAAG;IAC/B,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,oBAAY,IAAI,GAAG;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,oBAAY,IAAI,GAAG;IACjB,OAAO,CAAC,EAAE,WAAW,EAAE,CAAC;IACxB,KAAK,EAAE;QACL,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;KAC1B,CAAC;CACH,CAAC;AAEF,oBAAY,IAAI,GAAG;IACjB,QAAQ,EAAE,IAAI,GAAG,IAAI,CAAC;IACtB,MAAM,EAAE;QAAE,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI,CAAA;KAAE,CAAC;CACxC,CAAC;AAcF,eAAO,MAAM,KAAK,SAAU,OAAO,QAAQ,IAAI,KAAG,IAoCjD,CAAC;AAEF,eAAO,MAAM,UAAU,aACX,MAAM,SACT,MAAM,EAAE,8BAEd,OAEF,CAAC;AAEF,eAAO,MAAM,iBAAiB,aAClB,MAAM,SACT,MAAM,EAAE,8BAEd,IAoBF,CAAC"}
\ No newline at end of file diff --git a/node_modules/magic-bytes.js/dist/model/tree.js b/node_modules/magic-bytes.js/dist/model/tree.js new file mode 100644 index 0000000..22a680c --- /dev/null +++ b/node_modules/magic-bytes.js/dist/model/tree.js @@ -0,0 +1,70 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.createComplexNode = exports.createNode = exports.merge = void 0; +const createMatch = (leaf) => ({ + typename: leaf.typename, + mime: leaf.info.mime, + extension: leaf.info.extension, +}); +const isMatchingNode = (tree, path) => tree && path.length === 0; +const head = (arr) => arr[0]; +const tail = (arr) => arr.slice(1, arr.length); +const merge = (node, tree) => { + if (node.bytes.length === 0) + return tree; + const currentByte = head(node.bytes); // 0 + const path = tail(node.bytes); // [1,2] + const currentTree = tree.bytes[currentByte]; + // traversed to end. Just add key to leaf. + if (isMatchingNode(currentTree, path)) { + const matchingNode = tree.bytes[currentByte]; + tree.bytes[currentByte] = { + ...matchingNode, + matches: [ + ...(matchingNode.matches ? matchingNode.matches : []), + createMatch(node), + ], + }; + return tree; + } + // Path exists already, Merge subtree + if (tree.bytes[currentByte]) { + tree.bytes[currentByte] = exports.merge(exports.createNode(node.typename, path, node.info), tree.bytes[currentByte]); + return tree; + } + // Tree did not exist before + if (!tree.bytes[currentByte]) { + tree.bytes[currentByte] = { + ...tree.bytes[currentByte], + ...exports.createComplexNode(node.typename, path, node.info), + }; + } + return tree; +}; +exports.merge = merge; +const createNode = (typename, bytes, info) => { + return { typename, bytes, info: info ? info : {} }; +}; +exports.createNode = createNode; +const createComplexNode = (typename, bytes, info) => { + let obj = { + bytes: {}, + matches: undefined, + }; + const currentKey = head(bytes); // 0 + const path = tail(bytes); // [1,2] + if (bytes.length === 0) { + return { + matches: [ + createMatch({ + typename: typename, + info: info ? { extension: info.extension, mime: info.mime } : {}, + }), + ], + bytes: {}, + }; + } + obj.bytes[currentKey] = exports.createComplexNode(typename, path, info); + return obj; +}; +exports.createComplexNode = createComplexNode; diff --git a/node_modules/magic-bytes.js/dist/model/tree.spec.d.ts b/node_modules/magic-bytes.js/dist/model/tree.spec.d.ts new file mode 100644 index 0000000..15bc445 --- /dev/null +++ b/node_modules/magic-bytes.js/dist/model/tree.spec.d.ts @@ -0,0 +1,2 @@ +export {}; +//# sourceMappingURL=tree.spec.d.ts.map
\ No newline at end of file diff --git a/node_modules/magic-bytes.js/dist/model/tree.spec.d.ts.map b/node_modules/magic-bytes.js/dist/model/tree.spec.d.ts.map new file mode 100644 index 0000000..799b4a0 --- /dev/null +++ b/node_modules/magic-bytes.js/dist/model/tree.spec.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"tree.spec.d.ts","sourceRoot":"","sources":["../../src/model/tree.spec.ts"],"names":[],"mappings":""}
\ No newline at end of file |