From 7fbf110949ab5fa5af1910d12171e204eacbfc6c Mon Sep 17 00:00:00 2001 From: Borewit Date: Wed, 11 Dec 2024 22:25:10 +0100 Subject: [PATCH] Add support for `.drc`, Google's Draco 3D Data Compression Resolves: #427 --- core.js | 7 +++++++ fixture/fixture-cube_pc.drc | Bin 0 -> 224 bytes package.json | 3 ++- readme.md | 1 + supported.js | 2 ++ test.js | 3 +++ 6 files changed, 15 insertions(+), 1 deletion(-) create mode 100644 fixture/fixture-cube_pc.drc diff --git a/core.js b/core.js index 7587100a..53e5eb8a 100644 --- a/core.js +++ b/core.js @@ -1056,6 +1056,13 @@ export class FileTypeParser { }; } + if (this.checkString('DRACO')) { + return { + ext: 'drc', + mime: 'application/vnd.google.draco', // Invented by us + }; + } + // -- 6-byte signatures -- if (this.check([0xFD, 0x37, 0x7A, 0x58, 0x5A, 0x00])) { diff --git a/fixture/fixture-cube_pc.drc b/fixture/fixture-cube_pc.drc new file mode 100644 index 0000000000000000000000000000000000000000..48396596411c31eab37da5d9e26334460fb9c473 GIT binary patch literal 224 zcmZ<>a&-1*WMlvW2_R-<2C+CnBr_)yNC3=cVq#_hs{zSEK!ZIWBO_3lfnlPuEPp63 zKU91%^Kz%+85tEU1-lRacUlD!{cjH>khC}0^FXzRiiV0tit<3UhP?Z%&v2~YA=|*c z6|4_rCKDGU12>4rXaFLCAe4127aN4hpej&X;@7~y!13p~{Repl1_cHNAn*Tw=KnyK I{Ri3!0QtlqE&u=k literal 0 HcmV?d00001 diff --git a/package.json b/package.json index 0716b6e0..233c041e 100644 --- a/package.json +++ b/package.json @@ -217,7 +217,8 @@ "fbx", "vsdx", "vtt", - "apk" + "apk", + "drc" ], "dependencies": { "strtok3": "^10.0.0", diff --git a/readme.md b/readme.md index 48b35119..f6afa9c6 100644 --- a/readme.md +++ b/readme.md @@ -442,6 +442,7 @@ abortController.abort(); // Abort file-type reading from the Blob stream. - [`dmg`](https://en.wikipedia.org/wiki/Apple_Disk_Image) - Apple Disk Image - [`dng`](https://en.wikipedia.org/wiki/Digital_Negative) - Adobe Digital Negative image file - [`docx`](https://en.wikipedia.org/wiki/Office_Open_XML) - Microsoft Word document +- [`drc`](https://en.wikipedia.org/wiki/Zstandard) - Google's Draco 3D Data Compression - [`dsf`](https://dsd-guide.com/sites/default/files/white-papers/DSFFileFormatSpec_E.pdf) - Sony DSD Stream File (DSF) - [`dwg`](https://en.wikipedia.org/wiki/.dwg) - Autodesk CAD file - [`elf`](https://en.wikipedia.org/wiki/Executable_and_Linkable_Format) - Unix Executable and Linkable Format diff --git a/supported.js b/supported.js index 25294cd9..4b6b55d7 100644 --- a/supported.js +++ b/supported.js @@ -154,6 +154,7 @@ export const extensions = [ 'vsdx', 'vtt', 'apk', + 'drc', ]; export const mimeTypes = [ @@ -307,4 +308,5 @@ export const mimeTypes = [ 'application/x.autodesk.fbx', // Invented by us 'application/vnd.visio', 'application/vnd.android.package-archive', + 'application/vnd.google.draco', // Invented by us ]; diff --git a/test.js b/test.js index 4c2e8b81..f744b56e 100644 --- a/test.js +++ b/test.js @@ -54,6 +54,9 @@ const names = { dng: [ 'fixture-Leica-M10', ], + drc: [ + 'fixture-cube_pc', + ], epub: [ 'fixture', 'fixture-crlf',