file-type 21.1.0 → 21.1.1
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 +11 -2
- package/package.json +4 -4
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 {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "file-type",
|
|
3
|
-
"version": "21.1.
|
|
3
|
+
"version": "21.1.1",
|
|
4
4
|
"description": "Detect the file type of a file, stream, or data",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": "sindresorhus/file-type",
|
|
@@ -249,9 +249,9 @@
|
|
|
249
249
|
"dat"
|
|
250
250
|
],
|
|
251
251
|
"dependencies": {
|
|
252
|
-
"@tokenizer/inflate": "^0.
|
|
253
|
-
"strtok3": "^10.3.
|
|
254
|
-
"token-types": "^6.
|
|
252
|
+
"@tokenizer/inflate": "^0.4.1",
|
|
253
|
+
"strtok3": "^10.3.4",
|
|
254
|
+
"token-types": "^6.1.1",
|
|
255
255
|
"uint8array-extras": "^1.4.0"
|
|
256
256
|
},
|
|
257
257
|
"devDependencies": {
|