Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for SKP #351

Merged
merged 3 commits into from Apr 23, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions core.d.ts
Expand Up @@ -129,6 +129,7 @@ declare namespace core {
| 's3m'
| 'xm'
| 'ai'
| 'skp'
| 'avif';

type MimeType =
Expand Down Expand Up @@ -250,6 +251,7 @@ declare namespace core {
| 'audio/x-xm'
| 'video/MP1S'
| 'video/MP2P'
| 'application/vnd.sketchup.skp'
| 'image/avif';

interface FileTypeResult {
Expand Down
7 changes: 7 additions & 0 deletions core.js
Expand Up @@ -1231,6 +1231,13 @@ async function _fromTokenizer(tokenizer) {
};
}

if (check([0xFF, 0xFE, 0xFF, 0x0E, 0x53, 0x00, 0x6B, 0x00, 0x65, 0x00, 0x74, 0x00, 0x63, 0x00, 0x68, 0x00, 0x55, 0x00, 0x70, 0x00, 0x20, 0x00, 0x4D, 0x00, 0x6F, 0x00, 0x64, 0x00, 0x65, 0x00, 0x6C, 0x00])) {
return {
ext: 'skp',
mime: 'application/vnd.sketchup.skp'
};
}

// Check for MPEG header at different starting offsets
for (let start = 0; start < 2 && start < (buffer.length - 16); start++) {
// Check MPEG 1 or 2 Layer 3 header, or 'layer 0' for ADTS (MPEG sync-word 0xFFE)
Expand Down
Binary file added fixture/fixture.skp
Binary file not shown.
1 change: 1 addition & 0 deletions package.json
Expand Up @@ -172,6 +172,7 @@
"s3m",
"xm",
"ai",
"skp",
"avif"
],
"devDependencies": {
Expand Down
1 change: 1 addition & 0 deletions readme.md
Expand Up @@ -395,6 +395,7 @@ Returns a set of supported MIME types.
- [`s3m`](https://wiki.openmpt.org/Manual:_Module_formats#The_ScreamTracker_3_format_.28.s3m.29) - Audio module format: ScreamTracker 3
- [`xm`](https://wiki.openmpt.org/Manual:_Module_formats#The_FastTracker_2_format_.28.xm.29) - Audio module format: FastTracker 2
- [`ai`](https://en.wikipedia.org/wiki/Adobe_Illustrator_Artwork) - Adobe Illustrator Artwork
- [`skp`](https://en.wikipedia.org/wiki/SketchUp) - SketchUp
- [`avif`](https://en.wikipedia.org/wiki/AV1#AV1_Image_File_Format_(AVIF)) - AV1 Image File Format

*Pull requests are welcome for additional commonly used file types.*
Expand Down
2 changes: 2 additions & 0 deletions supported.js
Expand Up @@ -127,6 +127,7 @@ module.exports = {
's3m',
'xm',
'ai',
'skp',
'avif'
],
mimeTypes: [
Expand Down Expand Up @@ -248,6 +249,7 @@ module.exports = {
'audio/x-xm',
'video/MP1S',
'video/MP2P',
'application/vnd.sketchup.skp',
'image/avif'
]
};