mime-bytes 0.1.1 → 0.3.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/esm/file-type-detector.js +3 -3
- package/esm/file-types-registry.js +715 -715
- package/esm/index.js +4 -4
- package/file-type-detector.d.ts +1 -1
- package/file-type-detector.js +3 -3
- package/file-types-registry.js +715 -715
- package/index.d.ts +4 -4
- package/index.js +9 -9
- package/package.json +2 -2
- package/peak.d.ts +1 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
// Main file type detector class with stream-focused API
|
|
2
|
+
import { detectCharset, FILE_TYPES, getContentTypeByExtension, getContentTypeForExtension, getFileTypeByExtension, getFileTypesByCategory } from './file-types-registry';
|
|
2
3
|
import { peek } from './peak';
|
|
3
|
-
import { FILE_TYPES, getFileTypeByExtension, getFileTypesByCategory, getContentTypeByExtension, detectCharset, getContentTypeForExtension } from './file-types-registry';
|
|
4
|
-
import { compareBytes } from './utils/magic-bytes';
|
|
5
4
|
import { normalizeExtension } from './utils/extensions';
|
|
5
|
+
import { compareBytes } from './utils/magic-bytes';
|
|
6
6
|
import { resolveMimeAlias } from './utils/mime-types';
|
|
7
7
|
export class FileTypeDetector {
|
|
8
8
|
fileTypes;
|
|
@@ -248,7 +248,7 @@ export class FileTypeDetector {
|
|
|
248
248
|
if (lastDot !== -1) {
|
|
249
249
|
const extension = filename.substring(lastDot + 1);
|
|
250
250
|
// Check for generic text files that might have specific content types
|
|
251
|
-
if (magicResult.
|
|
251
|
+
if (magicResult.mimeType === 'text/plain' && magicResult.charset) {
|
|
252
252
|
const contentType = getContentTypeForExtension(extension, magicResult.charset);
|
|
253
253
|
if (contentType) {
|
|
254
254
|
// Enhance the result with charset-aware content type
|