@depup/file-type 22.1.0-depup.0 → 22.1.1-depup.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/README.md CHANGED
@@ -13,8 +13,8 @@ npm install @depup/file-type
13
13
 
14
14
  | Field | Value |
15
15
  |-------|-------|
16
- | Original | [file-type](https://www.npmjs.com/package/file-type) @ 22.1.0 |
17
- | Processed | 2026-09-11 |
16
+ | Original | [file-type](https://www.npmjs.com/package/file-type) @ 22.1.1 |
17
+ | Processed | 2026-09-17 |
18
18
  | Smoke test | passed |
19
19
  | Deps updated | 0 |
20
20
 
package/changes.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "bumped": {},
3
- "timestamp": "2026-09-11T16:12:02.029Z",
3
+ "timestamp": "2026-09-17T08:13:12.533Z",
4
4
  "totalUpdated": 0
5
5
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@depup/file-type",
3
- "version": "22.1.0-depup.0",
3
+ "version": "22.1.1-depup.0",
4
4
  "description": "Detect the file type of a file, stream, or data (with updated dependencies)",
5
5
  "license": "MIT",
6
6
  "repository": "sindresorhus/file-type",
@@ -284,8 +284,8 @@
284
284
  "changes": {},
285
285
  "depsUpdated": 0,
286
286
  "originalPackage": "file-type",
287
- "originalVersion": "22.1.0",
288
- "processedAt": "2026-09-11T16:12:10.970Z",
287
+ "originalVersion": "22.1.1",
288
+ "processedAt": "2026-09-17T08:13:23.660Z",
289
289
  "smokeTest": "passed"
290
290
  }
291
291
  }
package/readme.md CHANGED
@@ -581,6 +581,8 @@ MIME media subtypes prefixed with `x-ft-` are custom and defined by us. They are
581
581
 
582
582
  ISO 9660 requires random-access input or `fileTypeStream()` with `sampleSize >= 32_774`; `fileTypeFromStream()` is unsupported.
583
583
 
584
+ When `[Content_Types].xml` cannot be reached — it may trail the content entries, and only so much of what precedes it is scanned — the type is guessed from the archive's directory names: `word/`, `xl/` and `ppt/` are reported as `docx`, `xlsx` and `pptx`. Macro-enabled and template variants are therefore reported as their base type, and a non-OOXML archive containing one of those directories is reported as OOXML.
585
+
584
586
  *[Pull requests](.github/pull_request_template.md) are welcome for additional commonly used file types.*
585
587
 
586
588
  The following file types will not be accepted, but most of them are supported by [third-party detectors](#available-third-party-file-type-detectors).
@@ -392,7 +392,7 @@ async function readZipDataDescriptorEntryWithLimit(zipHandler, {shouldBuffer, ma
392
392
 
393
393
  bytesConsumed += chunkLength;
394
394
  if (bytesConsumed > maximumLength) {
395
- throw new Error(`ZIP entry compressed data exceeds ${maximumLength} bytes`);
395
+ throw new ParserHardLimitError(`ZIP entry data descriptor not found within ${maximumLength} bytes`);
396
396
  }
397
397
 
398
398
  if (shouldBuffer) {
@@ -626,9 +626,14 @@ export async function detectZip(tokenizer) {
626
626
  openXmlState.hasUnparseableContentTypes = true;
627
627
  }
628
628
 
629
- // When the stream was truncated before reaching [Content_Types].xml, use directory names as a fallback.
630
- // This handles LibreOffice-created OOXML files where [Content_Types].xml appears after content entries.
631
- if (!fileType && error instanceof strtok3.EndOfStreamError && !openXmlState.hasContentTypesEntry) {
629
+ // Producers are free to put [Content_Types].xml after the content entries, so running out of
630
+ // input or budget before reaching it says nothing about whether this is an OOXML file.
631
+ // Guess from the directory names instead.
632
+ if (
633
+ !fileType
634
+ && (error instanceof strtok3.EndOfStreamError || error instanceof ParserHardLimitError)
635
+ && !openXmlState.hasContentTypesEntry
636
+ ) {
632
637
  fileType = getOpenXmlFileTypeFromDirectoryNames(openXmlState);
633
638
  }
634
639
  }