CFFI bindings for libmagic.
Project description
CFFI bindings for libmagic.
Free software: MIT License
Installation
pip install file
Usage
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.1.0 (2017-11-02)
First release on PyPI.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
file-0.2.0.tar.gz
(15.6 kB
view hashes)
Built Distributions
Close
Hashes for file-0.2.0-cp36-cp36m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7095e152e7c834be8efa09a7fc6b5a27562407a27e509fc10e3d752c138dc93f |
|
MD5 | 3e051b2083f666c5338cf505ae055176 |
|
BLAKE2b-256 | 429885995d95f5991e75a49ff26e2c616b7e090bd4854ce30c09b3602dada26e |
Close
Hashes for file-0.2.0-cp35-cp35m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6fa1d2b34ace83d949a2a20d0091d28ebaf5f4b10820256243dda05d60f49988 |
|
MD5 | 3eaae92b12fccfc11d67b9045001cb3f |
|
BLAKE2b-256 | 6b402381a7c8591cd7f9548c56abc07d99741cb5562efed623bd627a52c44fbf |
Close
Hashes for file-0.2.0-cp34-cp34m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e373ee1d43b534d18d0f278872ce7422fa38728d92ce8dbc875396a8d924c357 |
|
MD5 | ddd57096230fb798c2a6b24bada0cbf0 |
|
BLAKE2b-256 | c63a7782615ce050f11894753d296a5f712c290b1212ca3539a94b64269826ae |
Close
Hashes for file-0.2.0-cp33-cp33m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | fe55000f2678e4a7b98219d77e4028689d04284b692c43bf71831844ea7dac43 |
|
MD5 | 78e073334c0d1a2df661933c6410dc09 |
|
BLAKE2b-256 | 62489ca9c4389bf828ce5d575c7446e390967552f7ba4aed4cedf726669052c3 |
Close
Hashes for file-0.2.0-cp27-cp27mu-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c9da5bae48f9fe39836f55541aa6dbdaf83256e4043c168f3c4c5b3fb5e7e282 |
|
MD5 | 9c957e5ad307b739aaf8b43918ca524b |
|
BLAKE2b-256 | 61cf5ae26ab8713fb3cbd83486a9c017efc50455300382b0e66d8fdc1c3e50bf |
Close
Hashes for file-0.2.0-cp27-cp27m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ef06ae2a730df320bf6f2c9957361c4eb43833af3aefb6d632e67b8e11b14baa |
|
MD5 | 9e1b9c1de87d08ec91c5315a010d7cb2 |
|
BLAKE2b-256 | 3761f43b9f2786d9e03a0da2f51fb230eb9f03bb3db00fdec42361a42aeec596 |