file-0.3.0
توضیحات
CFFI bindings for libmagic.
| ویژگی | مقدار |
|---|---|
| سیستم عامل | Unix |
| نام فایل | file-0.3.0 |
| نام | file |
| نسخه کتابخانه | 0.3.0 |
| نگهدارنده | [] |
| ایمیل نگهدارنده | [] |
| نویسنده | Ionel Cristian Mărieș |
| ایمیل نویسنده | contact@ionelmc.ro |
| آدرس صفحه اصلی | https://github.com/ionelmc/python-file |
| آدرس اینترنتی | https://pypi.org/project/file/ |
| مجوز | MIT license |
========
Overview
========
CFFI bindings for libmagic.
* Free software: MIT License
Installation
============
::
pip install file
Usage
=====
.. code-block:: python
from file import Magic
with Magic() as magic:
print(magic.buffer("hello")) # => "text/plain"
from file import magic_buffer, magic_file, magic_setflags
magic = Magic()
mimetype = magic_buffer("\x89\x50\x4E\x47\x0D\x0A\x1A\x0A")
print(mimetype) # => "image/png"
mimetype = magic_file("/etc/passwd")
print(mimetype) # => "text/plain"
from file import MAGIC_NONE
magic_setflags(MAGIC_NONE)
mimetype = magic_file("demo.docx")
print(mimetype) # => "Microsoft Word 2007+"
magic.close() # don't forget about this
Changelog
=========
0.3.0 (2017-11-03)
------------------
* Remove ``magic_version`` - not available in old ``libmagic.so``.
* Remove ``magic`` object - will break import if there's a load failure.
0.2.1 (2017-11-02)
------------------
* Release without wheels.
0.2.0 (2017-11-02)
------------------
* First release on PyPI.
نحوه نصب
نصب پکیج whl file-0.3.0:
pip install file-0.3.0.whl
نصب پکیج tar.gz file-0.3.0:
pip install file-0.3.0.tar.gz