flying-anvil/fileinfo
Composer 安装命令:
composer require flying-anvil/fileinfo
包简介
Get information about files. Focused on exotic file types.
README 文档
README
Get information about files. Focused on exotic file types.
Supported Filetypes
| extension | description |
|---|---|
| Application | |
| Dev Tools | |
| diff | Output of the diff command (and git diff) |
| patch | Output of the diff command (and git diff) |
| Games | |
| lvlx | SMBX2 Level |
| gma | GMod Mod |
| d2s | Diablo 2 savegame |
| ROMs | |
| rpx | Wii U Application |
| spc | SPC700 Dump |
| smc | SNES Rom |
| sfc | Super Famicom Rom |
| z64 | Nintendo 64 Rom |
| nds | Nintendo DS Rom |
| gba | Nintendo GameBoy Advance Rom |
| gb | Nintendo GameBoy Rom |
| nes | NES ROM |
| Archive | |
| zip | Lossless compressed archive |
| jar | Java Archivce |
| Media | |
| Audio | |
| xm | Extended Module Audio File |
| mod | Module Audio File |
| wav | Uncompressed Wave audio |
| Video | |
| bik | Bink Video/Audio Container |
| bik2 | Bink Video/Audio Container |
| bk2 | Bink Video/Audio Container |
| Image | |
| png | Portable Network Graphic |
| bmp | Bitmap |
| gif | Graphics Interchange Format |
| jpg | Joint Photographic (Experts) Group |
| jpeg | Joint Photographic Experts Group |
| jfif | JPEG File Interchange Format |
| aseprite | Aseprite project file |
| Geometry | |
| obj | Wavefront OBJ |
| Misc | |
| url | Windows shortcuts that point to a webstite |
Restore Extension From Content
Can scan files to try to recognize the type and its file extension. Works for a ton of types.
CLI Usage
This package contains a script (fileinfo) that can be run from the CLI.
Usage: fileinfo [options] <file> [<file>...] [options]
See fileinfo --help for more information
List of supported options:
| short | long | description |
|---|---|---|
| h | help | Prints help text |
| v | version | Prints version text |
| a | all | Show all possible information |
| full | Same as all | |
| e | extension | Override extension |
| c | context | Use context instead of extension |
| r | reconstruct | Try to reconstruct extension for file by content |
| f | format | Format of the output |
| d | debug | Throw Exceptions (if not specified, print the message) |
Does work with multiple input files (fileinfo samples/*), however,
the output differs and might not be considered stable when multiple files are shown.
Development Notes
Adding a new FileInfoExtractor
- Create a new class in
src/InfoExtractor/Extractor/[…] - Implement
InfoExtractor- Try to use keys from
InfoCommonKeys
- Try to use keys from
- Create a new
KnownExtensionandContext - Register it in
DefaultDefinition
Adding a new ExtensionReader
For simple, non-offset magic bytes, add an entry to FileExtensionMagicByteSupplier::DEFAULT_SIMPLE_MAGIC.
For more complex ones:
- Create a new class in
src/FileExtension/Reader/[…] - Implement
FileExtensionMagicByteReader - Register it in
FileExtensionMagicByteSupplier::DEFAULT_READERS
Acquiring sample files
Run the following command and give it an extension: bin/download-samples.php $extension
--all can be used to download all available samples.
Note that not all extensions have samples to download, due to practical or copyright reasons.
Local docker testing
dcd run --rm php bin/fileinfo ./samples/$file
flying-anvil/fileinfo 适用场景与选型建议
flying-anvil/fileinfo 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 13 次下载、GitHub Stars 达 0, 最近一次更新时间为 2021 年 03 月 30 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 flying-anvil/fileinfo 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 flying-anvil/fileinfo 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 13
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 6
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2021-03-30