Skip to content

Commit

Permalink
Add support for visio
Browse files Browse the repository at this point in the history
  • Loading branch information
eboureau committed Jul 22, 2024
1 parent 64a0329 commit 091eea1
Show file tree
Hide file tree
Showing 8 changed files with 17 additions and 2 deletions.
2 changes: 2 additions & 0 deletions core.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ export type FileExtension =
| 'avro'
| 'icc'
| 'fbx'
| 'vsdx'
; // eslint-disable-line semi-style

export type MimeType =
Expand Down Expand Up @@ -314,6 +315,7 @@ export type MimeType =
| 'application/avro'
| 'application/vnd.iccprofile'
| 'application/x.autodesk.fbx'
| 'application/vnd.visio'
; // eslint-disable-line semi-style

export type FileTypeResult = {
Expand Down
5 changes: 5 additions & 0 deletions core.js
Original file line number Diff line number Diff line change
Expand Up @@ -381,6 +381,11 @@ export class FileTypeParser {
ext: 'xlsx',
mime: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
};
case 'visio':
return {
ext: 'vsdx',
mime: 'application/vnd.visio',
};
default:
break;
}
Expand Down
Binary file added fixture/fixture-vsdx.vsdx
Binary file not shown.
Binary file added fixture/fixture-vstx.vsdx
Binary file not shown.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,8 @@
"ace",
"avro",
"icc",
"fbx"
"fbx",
"vsdx"
],
"dependencies": {
"strtok3": "^8.0.0",
Expand Down
3 changes: 2 additions & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,7 @@ console.log(fileType);
- [`jxr`](https://en.wikipedia.org/wiki/JPEG_XR) - Joint Photographic Experts Group extended range
- [`ktx`](https://www.khronos.org/opengles/sdk/tools/KTX/file_format_spec/) - OpenGL and OpenGL ES textures
- [`lnk`](https://en.wikipedia.org/wiki/Shortcut_%28computing%29#Microsoft_Windows) - Microsoft Windows file shortcut
- [`lz`](https://en.wikipedia.org/wiki/Lzip) - Archive file
- [`lz`](https://en.wikipedia.org/wikihttps://en.wikipedia.org/wiki/Microsoft_Visiovsdx/Lzip) - Archive file
- [`lzh`](https://en.wikipedia.org/wiki/LHA_(file_format)) - LZH archive
- [`m4a`](https://en.wikipedia.org/wiki/M4A) - Audio-only MPEG-4 files
- [`m4b`](https://en.wikipedia.org/wiki/M4B) - Audiobook and podcast MPEG-4 files, which also contain metadata including chapter markers, images, and hyperlinks
Expand Down Expand Up @@ -505,6 +505,7 @@ console.log(fileType);
- [`ttf`](https://en.wikipedia.org/wiki/TrueType) - TrueType font
- [`vcf`](https://en.wikipedia.org/wiki/VCard) - vCard
- [`voc`](https://wiki.multimedia.cx/index.php/Creative_Voice) - Creative Voice File
- [`vsdx`](https://en.wikipedia.org/wiki/Microsoft_Visio) - Microsoft Visio File
- [`wasm`](https://en.wikipedia.org/wiki/WebAssembly) - WebAssembly intermediate compiled format
- [`wav`](https://en.wikipedia.org/wiki/WAV) - Waveform Audio file
- [`webm`](https://en.wikipedia.org/wiki/WebM) - Web video file
Expand Down
2 changes: 2 additions & 0 deletions supported.js
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ export const extensions = [
'avro',
'icc',
'fbx',
'vsdx',
];

export const mimeTypes = [
Expand Down Expand Up @@ -301,4 +302,5 @@ export const mimeTypes = [
'application/avro',
'application/vnd.iccprofile',
'application/x.autodesk.fbx', // Invented by us
'application/vnd.visio',
];
4 changes: 4 additions & 0 deletions test.js
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,10 @@ const names = {
'fixture-bin',
'fixture-ascii',
],
vsdx: [
'fixture-vsdx',
'fixture-vstx',
],
};

// Define an entry here only if the file type has potential
Expand Down

0 comments on commit 091eea1

Please sign in to comment.