Skip to main content

类型检测

项目描述

派皮 PyPI - Python 版本 PyPI - 许可证 PyPI - 状态 PyPI - 下载

一个类型检测库。

特性

  1. 检测类型齐全,需要检测的类型,中的检测类型,直接写新模块。

  2. 主要给予逆向工程方向的检测类型,也支持一般类型的检测。

安装

❯ pip install pyftype

❯ pyftype -h
usage: pyftype [-h] [-V] p

positional arguments:
  p              path

options:
  -h, --help     show this help message and exit
  -V, --version  show program's version number and exit

❯ pyftype Makefile
File extension: txt
File MIME type: application/txt

翻译

import pyftype

# file
f = open(path, "rb")
data = f.read()
kind = pyftype.guess(data)

# path
kind = pyftype.guess(path)

# bytes
buf = bytearray([0xFF, 0xD8, 0xFF, 0x00, 0x08])
kind = pyftype.guess(buf)

具体参考示例目录

参考

项目详情


下载文件

下载适用于您平台的文件。如果您不确定要选择哪个,请了解有关安装包的更多信息。

内置分布

pyftype-1.2.4-py3-none-any.whl (13.4 kB 查看哈希)

已上传 py3