summaryrefslogtreecommitdiff
path: root/node_modules/magic-bytes.js
diff options
context:
space:
mode:
authorsowgro <tpoke.ferrari@gmail.com>2023-09-02 19:12:47 -0400
committersowgro <tpoke.ferrari@gmail.com>2023-09-02 19:12:47 -0400
commite4450c8417624b71d779cb4f41692538f9165e10 (patch)
treeb70826542223ecdf8a7a259f61b0a1abb8a217d8 /node_modules/magic-bytes.js
downloadsowbot3-e4450c8417624b71d779cb4f41692538f9165e10.tar.gz
sowbot3-e4450c8417624b71d779cb4f41692538f9165e10.tar.bz2
sowbot3-e4450c8417624b71d779cb4f41692538f9165e10.zip
first commit
Diffstat (limited to 'node_modules/magic-bytes.js')
-rw-r--r--node_modules/magic-bytes.js/.github/workflows/build-and-test.yml29
-rw-r--r--node_modules/magic-bytes.js/.prettierignore1
-rw-r--r--node_modules/magic-bytes.js/LICENSE21
-rw-r--r--node_modules/magic-bytes.js/README.md92
-rw-r--r--node_modules/magic-bytes.js/dist/create-snapshot.d.ts2
-rw-r--r--node_modules/magic-bytes.js/dist/create-snapshot.d.ts.map1
-rw-r--r--node_modules/magic-bytes.js/dist/create-snapshot.js11
-rw-r--r--node_modules/magic-bytes.js/dist/index.d.ts7
-rw-r--r--node_modules/magic-bytes.js/dist/index.d.ts.map1
-rw-r--r--node_modules/magic-bytes.js/dist/index.js56
-rw-r--r--node_modules/magic-bytes.js/dist/index.spec.d.ts2
-rw-r--r--node_modules/magic-bytes.js/dist/index.spec.d.ts.map1
-rw-r--r--node_modules/magic-bytes.js/dist/model/pattern-tree.d.ts4
-rw-r--r--node_modules/magic-bytes.js/dist/model/pattern-tree.d.ts.map1
-rw-r--r--node_modules/magic-bytes.js/dist/model/pattern-tree.js764
-rw-r--r--node_modules/magic-bytes.js/dist/model/toHex.d.ts3
-rw-r--r--node_modules/magic-bytes.js/dist/model/toHex.d.ts.map1
-rw-r--r--node_modules/magic-bytes.js/dist/model/toHex.js8
-rw-r--r--node_modules/magic-bytes.js/dist/model/tree.d.ts30
-rw-r--r--node_modules/magic-bytes.js/dist/model/tree.d.ts.map1
-rw-r--r--node_modules/magic-bytes.js/dist/model/tree.js70
-rw-r--r--node_modules/magic-bytes.js/dist/model/tree.spec.d.ts2
-rw-r--r--node_modules/magic-bytes.js/dist/model/tree.spec.d.ts.map1
-rw-r--r--node_modules/magic-bytes.js/jest.config.js5
-rw-r--r--node_modules/magic-bytes.js/package.json48
-rw-r--r--node_modules/magic-bytes.js/tsconfig.json78
26 files changed, 1240 insertions, 0 deletions
diff --git a/node_modules/magic-bytes.js/.github/workflows/build-and-test.yml b/node_modules/magic-bytes.js/.github/workflows/build-and-test.yml
new file mode 100644
index 0000000..199d121
--- /dev/null
+++ b/node_modules/magic-bytes.js/.github/workflows/build-and-test.yml
@@ -0,0 +1,29 @@
+
+name: Build and test
+on:
+ push:
+ branches: [master]
+jobs:
+ buildAndTest:
+ name: Build and test (Node.js v${{ matrix.node-version }})
+ timeout-minutes: 15
+ runs-on: ubuntu-latest
+ strategy:
+ matrix:
+ node-version: [14]
+ steps:
+ - uses: actions/checkout@v2
+ - name: Install Node.js
+ uses: actions/setup-node@v2
+ with:
+ node-version: ${{ matrix.node-version }}
+ registry-url: 'https://registry.npmjs.org'
+ - name: Install install dependencies
+ run: npm ci
+ - name: test
+ run: npm test
+ - name: build
+ run: npm run build
+ - run: npm publish
+ env:
+ NODE_AUTH_TOKEN: ${{ secrets.NPM_SECRET_TOKEN }}
diff --git a/node_modules/magic-bytes.js/.prettierignore b/node_modules/magic-bytes.js/.prettierignore
new file mode 100644
index 0000000..84184c6
--- /dev/null
+++ b/node_modules/magic-bytes.js/.prettierignore
@@ -0,0 +1 @@
+src/pattern-tree.snapshot.ts
diff --git a/node_modules/magic-bytes.js/LICENSE b/node_modules/magic-bytes.js/LICENSE
new file mode 100644
index 0000000..b9455e9
--- /dev/null
+++ b/node_modules/magic-bytes.js/LICENSE
@@ -0,0 +1,21 @@
+MIT License
+
+Copyright (c) 2022 Lars Kölpin
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
diff --git a/node_modules/magic-bytes.js/README.md b/node_modules/magic-bytes.js/README.md
new file mode 100644
index 0000000..9428b95
--- /dev/null
+++ b/node_modules/magic-bytes.js/README.md
@@ -0,0 +1,92 @@
+# Magic bytes
+
+[![Build Status](https://travis-ci.org/LarsKoelpin/magic-bytes.svg?branch=master)](https://travis-ci.org/LarsKoelpin/magic-bytes)
+
+
+Magic Bytes is a javascript library analyzing the first bytes of a file to tell you its type. The procedure
+is based on https://en.wikipedia.org/wiki/List_of_file_signatures.
+
+# Installation
+Run `npm install magic-bytes.js`
+
+# Usage
+On server:
+```javascript
+import filetype from 'magic-bytes.js'
+
+filetype(fs.readFileSync("myimage.png")) // ["png"]
+```
+
+Using HTML:
+```html
+<input type="file" id="file" />
+
+ <script src="node_modules/magic-bytes.js/dist/browser.js" type="application/javascript"></script>
+<script>
+ document.getElementById("file").addEventListener('change', (event, x) => {
+ const fileReader = new FileReader();
+ fileReader.onloadend = (f) => {
+ const bytes = new Uint8Array(f.target.result);
+ console.log("Possible filetypes: " + filetypeinfo(bytes))
+ }
+ fileReader.readAsArrayBuffer(event.target.files[0])
+ })
+</script>
+```
+
+# API
+The following functions are availble:
+* `filetypeinfo(bytes: number[])` Contains typeinformation like name, extension and mime type: `[{typename: "zip"}, {typename: "jar"}]`
+* `filetypename(bytes: number[])` : Contains type names only: `["zip", "jar"]`
+* `filetypemime(bytes: number[])` : Contains type mime types only: `["application/zip", "application/jar"]`
+* `filetypeextension(bytes: number[])` : Contains type extensions only: `["zip", "jar"]`
+
+Both function return an empty array `[]` otherwise, which means it could not detect the file signature. Keep in mind that
+txt files for example fall in this category.
+
+You don't have to load the whole file in memory. For validating a file uploaded to S3 using Lambda for example, it may be
+enough to load the files first 100 bytes and validate against them. This is especially useful for big files.
+
+see examples for practical usage.
+
+# Tests
+Run `npm test`
+
+# Example
+See examples/
+
+# How does it work
+The `create-snapshot.js` creates a new tree. The tree has a similar shape to the following
+```json
+{
+ "0x47": {
+ "0x49": {
+ "0x46": {
+ "0x38": {
+ "0x37": {
+ "0x61": {
+ "matches": [
+ {
+ "typename": "gif",
+ "mime": "image/gif",
+ "extension": "gif"
+ }
+ ]
+ }
+ },
+ }
+ }
+ }
+ }
+}
+```
+
+It acts as a giant lookup map for the given byte signatures. To check all available entries, have a look at `pattern-tree.js` and its
+generated `pattern-tree.snapshot`, which acts as a static resource.
+
+# Supported types
+Please refer to `src/pattern-tree.js`
+
+# Roadmap
+* Specialize type detection(like zip) using offset-subtrees
+* Add encoding detection
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
diff --git a/node_modules/magic-bytes.js/jest.config.js b/node_modules/magic-bytes.js/jest.config.js
new file mode 100644
index 0000000..8cbf894
--- /dev/null
+++ b/node_modules/magic-bytes.js/jest.config.js
@@ -0,0 +1,5 @@
+/** @type {import('ts-jest/dist/types').InitialOptionsTsJest} */
+module.exports = {
+ preset: 'ts-jest',
+ testEnvironment: 'node',
+}; \ No newline at end of file
diff --git a/node_modules/magic-bytes.js/package.json b/node_modules/magic-bytes.js/package.json
new file mode 100644
index 0000000..28c15ed
--- /dev/null
+++ b/node_modules/magic-bytes.js/package.json
@@ -0,0 +1,48 @@
+{
+ "name": "magic-bytes.js",
+ "version": "1.0.15",
+ "main": "./dist/index.js",
+ "module": "./dist/index.js",
+ "types": "./dist/index.d.ts",
+ "scripts": {
+ "prettier": "prettier --write \"{src,__{tests,mocks}__}/**/*.{tsx,ts}\"",
+ "gen-tree": "ts-node ./src/create-snapshot.ts",
+ "pre-test": "jest --clear-cache",
+ "test": "jest",
+ "build": "tsc"
+ },
+ "repository": {
+ "url": "https://github.com/LarsKoelpin/magic-bytes",
+ "type": "git"
+ },
+ "author": "Lars Kölpin",
+ "license": "MIT",
+ "description": "Detect Filetype by bytes",
+ "keywords": [
+ "magic-bytes",
+ "mime",
+ "filetype",
+ "file",
+ "extension",
+ "magic byte",
+ "magic number",
+ "mime",
+ "mimetype",
+ "validation",
+ "javascript",
+ "upload"
+ ],
+ "devDependencies": {
+ "@babel/preset-typescript": "^7.15.0",
+ "@changesets/cli": "^2.16.0",
+ "@types/jest": "^27.0.1",
+ "@types/node": "^16.6.2",
+ "jest": "^27.0.6",
+ "prettier": "^2.6.1",
+ "regenerator-runtime": "^0.11.1",
+ "ts-jest": "^27.0.5",
+ "ts-node": "^10.2.1",
+ "typescript": "^4.3.5",
+ "prettier-plugin-organize-imports": "^2.3.4"
+ }
+}
diff --git a/node_modules/magic-bytes.js/tsconfig.json b/node_modules/magic-bytes.js/tsconfig.json
new file mode 100644
index 0000000..ddb86d7
--- /dev/null
+++ b/node_modules/magic-bytes.js/tsconfig.json
@@ -0,0 +1,78 @@
+{
+ "compilerOptions": {
+ /* Visit https://aka.ms/tsconfig.json to read more about this file */
+
+ /* Basic Options */
+ // "incremental": true, /* Enable incremental compilation */
+ "target": "ES2020" /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019', 'ES2020', 'ES2021', or 'ESNEXT'. */,
+ "module": "commonjs" /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', 'es2020', or 'ESNext'. */,
+ "lib": [
+ "ES2020"
+ ] /* Specify library files to be included in the compilation. */,
+ // "allowJs": true, /* Allow javascript files to be compiled. */
+ // "checkJs": true, /* Report errors in .js files. */
+ // "jsx": "preserve", /* Specify JSX code generation: 'preserve', 'react-native', 'react', 'react-jsx' or 'react-jsxdev'. */
+ "declaration": true /* Generates corresponding '.d.ts' file. */,
+ "declarationMap": true /* Generates a sourcemap for each corresponding '.d.ts' file. */,
+ "sourceMap": false /* Generates corresponding '.map' file. */,
+ // "outFile": "./", /* Concatenate and emit output to single file. */
+ "outDir": "./dist" /* Redirect output structure to the directory. */,
+ "rootDir": "./src" /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */,
+ // "composite": true, /* Enable project compilation */
+ // "tsBuildInfoFile": "./", /* Specify file to store incremental compilation information */
+ // "removeComments": true, /* Do not emit comments to output. */
+ // "noEmit": true, /* Do not emit outputs. */
+ // "importHelpers": true, /* Import emit helpers from 'tslib'. */
+ // "downlevelIteration": true, /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */
+ // "isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */
+
+ /* Strict Type-Checking Options */
+ "strict": true /* Enable all strict type-checking options. */,
+ // "noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */
+ // "strictNullChecks": true, /* Enable strict null checks. */
+ // "strictFunctionTypes": true, /* Enable strict checking of function types. */
+ // "strictBindCallApply": true, /* Enable strict 'bind', 'call', and 'apply' methods on functions. */
+ // "strictPropertyInitialization": true, /* Enable strict checking of property initialization in classes. */
+ // "noImplicitThis": true, /* Raise error on 'this' expressions with an implied 'any' type. */
+ // "alwaysStrict": true, /* Parse in strict mode and emit "use strict" for each source file. */
+
+ /* Additional Checks */
+ // "noUnusedLocals": true, /* Report errors on unused locals. */
+ // "noUnusedParameters": true, /* Report errors on unused parameters. */
+ // "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */
+ // "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */
+ // "noUncheckedIndexedAccess": true, /* Include 'undefined' in index signature results */
+ // "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an 'override' modifier. */
+ // "noPropertyAccessFromIndexSignature": true, /* Require undeclared properties from index signatures to use element accesses. */
+
+ /* Module Resolution Options */
+ "moduleResolution": "node" /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */,
+ // "baseUrl": "./", /* Base directory to resolve non-absolute module names. */
+ // "paths": {}, /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */
+ // "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */
+ // "typeRoots": [], /* List of folders to include type definitions from. */
+ "types": [
+ "node",
+ "jest"
+ ] /* Type declaration files to be included in compilation. */,
+ // "allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */
+ "esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */,
+ // "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */
+ // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */
+
+ /* Source Map Options */
+ // "sourceRoot": "", /* Specify the location where debugger should locate TypeScript files instead of source locations. */
+ // "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */
+ // "inlineSourceMap": true, /* Emit a single file with source maps instead of having a separate file. */
+ // "inlineSources": true, /* Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set. */
+
+ /* Experimental Options */
+ // "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */
+ // "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */
+
+ /* Advanced Options */
+ "skipLibCheck": true /* Skip type checking of declaration files. */,
+ "forceConsistentCasingInFileNames": true /* Disallow inconsistently-cased references to the same file. */
+ },
+ "include": ["src/**/*"]
+}