Last 12 weeks · 3 commits
5 of 6 standards met
Description When passing an empty file that only contains a UTF-16 Little Endian BOM (FF FE), file-type incorrectly identifies it as an audio/mpeg .mp1 file. This issue occurs not only with empty files but also with fully populated UTF-16 LE text files (like valid .csv files). The presence of text data after the BOM does not prevent the false positive, making it impossible to rely on file-type when handling UTF-16 text files. ew.csv empty.csv Existing Issue Check [x] I have searched the existing issues and could not find any related to my problem. ESM (ECMAScript Module) Requirement Acknowledgment [x] My project is an ESM project and my contains the following entry: . File-Type Scope Acknowledgment [x] I understand that file-type detects binary file types and not text or other formats.
Description Common file types from the macOS-native Pages, Numbers and Keynote apps. Similar to Microsoft Office documents, these are zip files and can be detected by the file, which contains snappy-compressed protobuf messages. Keynote files can also be recognized by the contained and files, while for Pages and Numbers files probably the file has to be decompressed and parsed. Currently I have no time for this, for anyone else wanting to tackle this, here is some more information: I found this tool quite helpful https://sheetjs.com/tools/iwa-inspector/, its source code for decoding .iwa files can be found here. Also, this description of IWA files (especially "Determining File Type" at the bottom), as well as this one. Lastly, the Apache Tika toolkit also uses this method to detect iWork files (source), however they also have not implemented proper support for numbers and pages files yet: https://issues.apache.org/jira/browse/TIKA-4464 Existing Issue Check [x] I have searched the existing issues and could not find any related to my problem. File-Type Scope Acknowledgment [x] I understand that file-type detects binary file types and not text or other formats.
Description I saw that this was already an issue in 2020. But since version 21.1.0 I am seeing the behavior explained underneath. Version 21.0.0 still had the expected behavior. Current behavior docx, pptx, xlsx files saved with microsoft word are correctly detected as: application/vnd.openxmlformats-officedocument.wordprocessingml.document application/vnd.openxmlformats-officedocument.presentationml.presentation application/vnd.openxmlformats-officedocument.spreadsheetml.sheet docx, pptx, xlsx files saved with libre office are detected as application/zip. Expected behavior docx, pptx, xlsx files saved with libre office are detected as: application/vnd.openxmlformats-officedocument.wordprocessingml.document application/vnd.openxmlformats, officedocument.presentationml.presentation application/vnd.openxmlformats-officedocument.spreadsheetml.sheet Existing Issue Check [x] I have searched the existing issues and could not find any related to my problem. ESM (ECMAScript Module) Requirement Acknowledgment [x] My project is an ESM project and my contains the following entry: . File-Type Scope Acknowledgment [x] I understand that file-type detects binary file types and not text or other formats.
Repository: sindresorhus/file-type. Description: Detect the file type of a file, stream, or data Stars: 4321, Forks: 394. Primary language: JavaScript. Languages: JavaScript (93.4%), PostScript (5.9%), TypeScript (0.6%), Rich Text Format (0.1%). License: MIT. Topics: buffer, detect, file, file-types, javascript, magic, magic-numbers, nodejs, uint8array. Latest release: v22.0.2 (1w ago). Open PRs: 0, open issues: 0. Last activity: 1w ago. Community health: 100%. Top contributors: sindresorhus, Borewit, kevva, mifi, karlhiramoto, sly7-7, stroncium, mceachen, junmer, Richienb and others.