Skip to content

Commit e43cdc9

Browse files
authoredDec 21, 2020
Add support for CHM (#424)
Add support for CHM (Microsoft Compiled HTML Help)
1 parent b19e296 commit e43cdc9

File tree

6 files changed

+18
-5
lines changed

6 files changed

+18
-5
lines changed
 

‎core.d.ts

+4-2
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,8 @@ declare namespace core {
135135
| 'lzh'
136136
| 'pgp'
137137
| 'asar'
138-
| 'stl';
138+
| 'stl'
139+
| 'chm';
139140

140141
type MimeType =
141142
| 'image/jpeg'
@@ -264,7 +265,8 @@ declare namespace core {
264265
| 'application/x-lzh-compressed'
265266
| 'application/pgp-encrypted'
266267
| 'application/x-asar'
267-
| 'model/stl';
268+
| 'model/stl'
269+
| 'application/vnd.ms-htmlhelp';
268270

269271
interface FileTypeResult {
270272
/**

‎core.js

+7
Original file line numberDiff line numberDiff line change
@@ -880,6 +880,13 @@ async function _fromTokenizer(tokenizer) {
880880
}
881881
}
882882

883+
if (checkString('ITSF')) {
884+
return {
885+
ext: 'chm',
886+
mime: 'application/vnd.ms-htmlhelp'
887+
};
888+
}
889+
883890
// -- 6-byte signatures --
884891

885892
if (check([0xFD, 0x37, 0x7A, 0x58, 0x5A, 0x00])) {

‎fixture/fixture.chm

9.94 KB
Binary file not shown.

‎package.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,8 @@
179179
"lzh",
180180
"pgp",
181181
"asar",
182-
"stl"
182+
"stl",
183+
"chm"
183184
],
184185
"devDependencies": {
185186
"@types/node": "^13.1.4",

‎readme.md

+1
Original file line numberDiff line numberDiff line change
@@ -404,6 +404,7 @@ Returns a set of supported MIME types.
404404
- [`pgp`](https://en.wikipedia.org/wiki/Pretty_Good_Privacy) - Pretty Good Privacy
405405
- [`asar`](https://github.com/electron/asar#format) - Archive format primarily used to enclose Electron applications
406406
- [`stl`](https://en.wikipedia.org/wiki/STL_(file_format)) - Standard Tesselated Geometry File Format (ASCII only)
407+
- [`chm`](https://en.wikipedia.org/wiki/Microsoft_Compiled_HTML_Help) - Microsoft Compiled HTML Help
407408

408409
*Pull requests are welcome for additional commonly used file types.*
409410

‎supported.js

+4-2
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,8 @@ module.exports = {
133133
'lzh',
134134
'pgp',
135135
'asar',
136-
'stl'
136+
'stl',
137+
'chm'
137138
],
138139
mimeTypes: [
139140
'image/jpeg',
@@ -262,6 +263,7 @@ module.exports = {
262263
'application/x-lzh-compressed',
263264
'application/pgp-encrypted',
264265
'application/x-asar',
265-
'model/stl'
266+
'model/stl',
267+
'application/vnd.ms-htmlhelp'
266268
]
267269
};

0 commit comments

Comments
 (0)
Please sign in to comment.