file-type 21.1.0 → 21.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/core.js +30 -2
- package/package.json +6 -4
- package/readme.md +2 -0
- package/supported.js +4 -0
package/core.js
CHANGED
|
@@ -416,8 +416,15 @@ export class FileTypeParser {
|
|
|
416
416
|
const gzipHandler = new GzipHandler(tokenizer);
|
|
417
417
|
|
|
418
418
|
const stream = gzipHandler.inflate();
|
|
419
|
+
let shouldCancelStream = true;
|
|
419
420
|
try {
|
|
420
|
-
|
|
421
|
+
let compressedFileType;
|
|
422
|
+
try {
|
|
423
|
+
compressedFileType = await this.fromStream(stream);
|
|
424
|
+
} catch {
|
|
425
|
+
shouldCancelStream = false;
|
|
426
|
+
}
|
|
427
|
+
|
|
421
428
|
if (compressedFileType && compressedFileType.ext === 'tar') {
|
|
422
429
|
return {
|
|
423
430
|
ext: 'tar.gz',
|
|
@@ -425,7 +432,9 @@ export class FileTypeParser {
|
|
|
425
432
|
};
|
|
426
433
|
}
|
|
427
434
|
} finally {
|
|
428
|
-
|
|
435
|
+
if (shouldCancelStream) {
|
|
436
|
+
await stream.cancel();
|
|
437
|
+
}
|
|
429
438
|
}
|
|
430
439
|
|
|
431
440
|
return {
|
|
@@ -963,6 +972,14 @@ export class FileTypeParser {
|
|
|
963
972
|
};
|
|
964
973
|
}
|
|
965
974
|
|
|
975
|
+
// SPSS Statistical Data File
|
|
976
|
+
if (this.checkString('$FL2') || this.checkString('$FL3')) {
|
|
977
|
+
return {
|
|
978
|
+
ext: 'sav',
|
|
979
|
+
mime: 'application/x-spss-sav',
|
|
980
|
+
};
|
|
981
|
+
}
|
|
982
|
+
|
|
966
983
|
// -- 5-byte signatures --
|
|
967
984
|
|
|
968
985
|
if (this.check([0x4F, 0x54, 0x54, 0x4F, 0x00])) {
|
|
@@ -1664,6 +1681,17 @@ export class FileTypeParser {
|
|
|
1664
1681
|
};
|
|
1665
1682
|
}
|
|
1666
1683
|
|
|
1684
|
+
// -- 16-byte signatures --
|
|
1685
|
+
|
|
1686
|
+
// JMP files - check for both Little Endian and Big Endian signatures
|
|
1687
|
+
if (this.check([0xFF, 0xFF, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00])
|
|
1688
|
+
|| this.check([0x00, 0x00, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x04, 0x00, 0x01, 0x00, 0x01])) {
|
|
1689
|
+
return {
|
|
1690
|
+
ext: 'jmp',
|
|
1691
|
+
mime: 'application/x-jmp-data',
|
|
1692
|
+
};
|
|
1693
|
+
}
|
|
1694
|
+
|
|
1667
1695
|
// Increase sample size from 256 to 512
|
|
1668
1696
|
await tokenizer.peekBuffer(this.buffer, {length: Math.min(512, tokenizer.fileInfo.size), mayBeLess: true});
|
|
1669
1697
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "file-type",
|
|
3
|
-
"version": "21.
|
|
3
|
+
"version": "21.2.0",
|
|
4
4
|
"description": "Detect the file type of a file, stream, or data",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": "sindresorhus/file-type",
|
|
@@ -241,7 +241,9 @@
|
|
|
241
241
|
"potm",
|
|
242
242
|
"pptm",
|
|
243
243
|
"jar",
|
|
244
|
+
"jmp",
|
|
244
245
|
"rm",
|
|
246
|
+
"sav",
|
|
245
247
|
"ppsm",
|
|
246
248
|
"ppsx",
|
|
247
249
|
"tar.gz",
|
|
@@ -249,9 +251,9 @@
|
|
|
249
251
|
"dat"
|
|
250
252
|
],
|
|
251
253
|
"dependencies": {
|
|
252
|
-
"@tokenizer/inflate": "^0.
|
|
253
|
-
"strtok3": "^10.3.
|
|
254
|
-
"token-types": "^6.
|
|
254
|
+
"@tokenizer/inflate": "^0.4.1",
|
|
255
|
+
"strtok3": "^10.3.4",
|
|
256
|
+
"token-types": "^6.1.1",
|
|
255
257
|
"uint8array-extras": "^1.4.0"
|
|
256
258
|
},
|
|
257
259
|
"devDependencies": {
|
package/readme.md
CHANGED
|
@@ -533,6 +533,7 @@ abortController.abort(); // Abort file-type reading from the Blob stream.
|
|
|
533
533
|
- [`j2c`](https://en.wikipedia.org/wiki/JPEG_2000) - JPEG 2000
|
|
534
534
|
- [`jar`](https://en.wikipedia.org/wiki/JAR_(file_format)) - Java archive
|
|
535
535
|
- [`jls`](https://en.wikipedia.org/wiki/Lossless_JPEG#JPEG-LS) - Lossless/near-lossless compression standard for continuous-tone images
|
|
536
|
+
- [`jmp`](https://en.wikipedia.org/wiki/JMP_(statistical_software)) - JMP data file format by SAS Institute
|
|
536
537
|
- [`jp2`](https://en.wikipedia.org/wiki/JPEG_2000) - JPEG 2000
|
|
537
538
|
- [`jpg`](https://en.wikipedia.org/wiki/JPEG) - Joint Photographic Experts Group image
|
|
538
539
|
- [`jpm`](https://en.wikipedia.org/wiki/JPEG_2000) - JPEG 2000
|
|
@@ -604,6 +605,7 @@ abortController.abort(); // Abort file-type reading from the Blob stream.
|
|
|
604
605
|
- [`rtf`](https://en.wikipedia.org/wiki/Rich_Text_Format) - Rich Text Format
|
|
605
606
|
- [`rw2`](https://en.wikipedia.org/wiki/Raw_image_format) - Panasonic RAW image file
|
|
606
607
|
- [`s3m`](https://wiki.openmpt.org/Manual:_Module_formats#The_ScreamTracker_3_format_.28.s3m.29) - Audio module format: ScreamTracker 3
|
|
608
|
+
- [`sav`](https://en.wikipedia.org/wiki/SPSS) - SPSS Statistical Data File
|
|
607
609
|
- [`shp`](https://en.wikipedia.org/wiki/Shapefile) - Geospatial vector data format
|
|
608
610
|
- [`skp`](https://en.wikipedia.org/wiki/SketchUp) - SketchUp
|
|
609
611
|
- [`spx`](https://en.wikipedia.org/wiki/Ogg) - Audio file
|
package/supported.js
CHANGED
|
@@ -171,7 +171,9 @@ export const extensions = [
|
|
|
171
171
|
'potm',
|
|
172
172
|
'pptm',
|
|
173
173
|
'jar',
|
|
174
|
+
'jmp',
|
|
174
175
|
'rm',
|
|
176
|
+
'sav',
|
|
175
177
|
'ppsm',
|
|
176
178
|
'ppsx',
|
|
177
179
|
'tar.gz',
|
|
@@ -351,6 +353,8 @@ export const mimeTypes = [
|
|
|
351
353
|
'application/vnd.ms-powerpoint.presentation.macroenabled.12',
|
|
352
354
|
'application/java-archive',
|
|
353
355
|
'application/vnd.rn-realmedia',
|
|
356
|
+
'application/x-spss-sav',
|
|
354
357
|
'application/x-ms-regedit',
|
|
355
358
|
'application/x-ft-windows-registry-hive',
|
|
359
|
+
'application/x-jmp-data',
|
|
356
360
|
];
|