@depup/file-type 22.0.2-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.0.2 |
17
- | Processed | 2026-08-15 |
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-08-15T08:06:46.600Z",
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.0.2-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",
@@ -236,7 +236,8 @@
236
236
  "dat",
237
237
  "key",
238
238
  "numbers",
239
- "pages"
239
+ "pages",
240
+ "iso"
240
241
  ],
241
242
  "dependencies": {
242
243
  "@tokenizer/inflate": "^0.4.1",
@@ -283,8 +284,8 @@
283
284
  "changes": {},
284
285
  "depsUpdated": 0,
285
286
  "originalPackage": "file-type",
286
- "originalVersion": "22.0.2",
287
- "processedAt": "2026-08-15T08:06:58.500Z",
287
+ "originalVersion": "22.1.1",
288
+ "processedAt": "2026-09-17T08:13:23.660Z",
288
289
  "smokeTest": "passed"
289
290
  }
290
291
  }
package/readme.md CHANGED
@@ -464,6 +464,7 @@ MIME media subtypes prefixed with `x-ft-` are custom and defined by us. They are
464
464
  - [`ico`](https://en.wikipedia.org/wiki/ICO_(file_format)) - Windows icon file
465
465
  - [`ics`](https://en.wikipedia.org/wiki/ICalendar#Data_format) - iCalendar
466
466
  - [`indd`](https://en.wikipedia.org/wiki/Adobe_InDesign#File_format) - Adobe InDesign document
467
+ - [`iso`](https://en.wikipedia.org/wiki/ISO_9660) - ISO 9660 disc image
467
468
  - [`it`](https://wiki.openmpt.org/Manual:_Module_formats#The_Impulse_Tracker_format_.28.it.29) - Audio module format: Impulse Tracker
468
469
  - [`j2c`](https://en.wikipedia.org/wiki/JPEG_2000) - JPEG 2000
469
470
  - [`jar`](https://en.wikipedia.org/wiki/JAR_(file_format)) - Java archive
@@ -578,6 +579,10 @@ MIME media subtypes prefixed with `x-ft-` are custom and defined by us. They are
578
579
  - [`zip`](https://en.wikipedia.org/wiki/Zip_(file_format)) - Archive file
579
580
  - [`zst`](https://en.wikipedia.org/wiki/Zstandard) - Archive file
580
581
 
582
+ ISO 9660 requires random-access input or `fileTypeStream()` with `sampleSize >= 32_774`; `fileTypeFromStream()` is unsupported.
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
+
581
586
  *[Pull requests](.github/pull_request_template.md) are welcome for additional commonly used file types.*
582
587
 
583
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
  }
package/source/index.js CHANGED
@@ -64,7 +64,7 @@ function getKnownFileSizeOrMaximum(fileSize) {
64
64
 
65
65
  // Keep the specifier non-literal at the call site so browser bundlers do not try to resolve Node-only imports.
66
66
  function importAtRuntime(specifier) {
67
- return import(specifier);
67
+ return import(/* @vite-ignore */ /* webpackIgnore: true */ specifier);
68
68
  }
69
69
 
70
70
  // Wrap stream in an identity TransformStream to avoid BYOB readers.
@@ -1689,6 +1689,33 @@ export class FileTypeParser {
1689
1689
  mime: 'application/pgp-encrypted',
1690
1690
  };
1691
1691
  }
1692
+
1693
+ // ISO 9660 optical disc image: the Volume Descriptor Set starts at sector 16 (2048-byte
1694
+ // sectors). Every descriptor in that set carries the 5-byte standard identifier `CD001`
1695
+ // at offset 1, regardless of descriptor type, so checking the first one is sufficient.
1696
+ // Only attempted for random-access inputs (buffer/file/blob, or a stream sampled with a
1697
+ // large enough `sampleSize`): on an unknown-size stream this offset is far past what's
1698
+ // reasonable to buffer just to rule out one format, so it's left undetected there.
1699
+ const isoStandardIdentifierOffset = 32_769;
1700
+ const isoStandardIdentifierLength = 5;
1701
+ if (
1702
+ tokenizer.supportsRandomAccess()
1703
+ && tokenizer.fileInfo.size >= (isoStandardIdentifierOffset + isoStandardIdentifierLength)
1704
+ ) {
1705
+ const isoStandardIdentifier = new Uint8Array(isoStandardIdentifierLength);
1706
+ await tokenizer.peekBuffer(isoStandardIdentifier, {
1707
+ position: isoStandardIdentifierOffset,
1708
+ length: isoStandardIdentifierLength,
1709
+ mayBeLess: true,
1710
+ });
1711
+
1712
+ if (checkBytes(isoStandardIdentifier, stringToBytes('CD001'))) {
1713
+ return {
1714
+ ext: 'iso',
1715
+ mime: 'application/x-iso9660-image',
1716
+ };
1717
+ }
1718
+ }
1692
1719
  };
1693
1720
  // Detections with limited supporting data, resulting in a higher likelihood of false positives
1694
1721
  detectImprecise = async tokenizer => {
@@ -184,6 +184,7 @@ export const extensions = [
184
184
  'key',
185
185
  'numbers',
186
186
  'pages',
187
+ 'iso',
187
188
  ];
188
189
 
189
190
  export const mimeTypes = [
@@ -365,4 +366,5 @@ export const mimeTypes = [
365
366
  'application/vnd.apple.keynote',
366
367
  'application/vnd.apple.numbers',
367
368
  'application/vnd.apple.pages',
369
+ 'application/x-iso9660-image',
368
370
  ];