Skip to main content

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 details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

file-0.2.0-cp36-cp36m-manylinux1_x86_64.whl (92.2 kB view details)

Uploaded CPython 3.6m

file-0.2.0-cp35-cp35m-manylinux1_x86_64.whl (92.2 kB view details)

Uploaded CPython 3.5m

file-0.2.0-cp34-cp34m-manylinux1_x86_64.whl (92.2 kB view details)

Uploaded CPython 3.4m

file-0.2.0-cp33-cp33m-manylinux1_x86_64.whl (92.1 kB view details)

Uploaded CPython 3.3m

file-0.2.0-cp27-cp27mu-manylinux1_x86_64.whl (95.4 kB view details)

Uploaded CPython 2.7mu

file-0.2.0-cp27-cp27m-manylinux1_x86_64.whl (95.4 kB view details)

Uploaded CPython 2.7m

File details

Details for the file file-0.2.0.tar.gz.

File metadata

  • Download URL: file-0.2.0.tar.gz
  • Upload date:
  • Size: 15.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for file-0.2.0.tar.gz
Algorithm Hash digest
SHA256 6b568d2091976e28e0ad5a17f039851a9e6a7658408f53f51bb3a2329214a6e4
MD5 013e073da776628ee67c626f75d0214e
BLAKE2b-256 001e75e56ef1dd6339477fd1aa21dcc962799fc165ee06895befb58320683417

See more details on using hashes here.

File details

Details for the file file-0.2.0-cp36-cp36m-manylinux1_x86_64.whl.

File metadata

File hashes

Hashes for file-0.2.0-cp36-cp36m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 7095e152e7c834be8efa09a7fc6b5a27562407a27e509fc10e3d752c138dc93f
MD5 3e051b2083f666c5338cf505ae055176
BLAKE2b-256 429885995d95f5991e75a49ff26e2c616b7e090bd4854ce30c09b3602dada26e

See more details on using hashes here.

File details

Details for the file file-0.2.0-cp35-cp35m-manylinux1_x86_64.whl.

File metadata

File hashes

Hashes for file-0.2.0-cp35-cp35m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 6fa1d2b34ace83d949a2a20d0091d28ebaf5f4b10820256243dda05d60f49988
MD5 3eaae92b12fccfc11d67b9045001cb3f
BLAKE2b-256 6b402381a7c8591cd7f9548c56abc07d99741cb5562efed623bd627a52c44fbf

See more details on using hashes here.

File details

Details for the file file-0.2.0-cp34-cp34m-manylinux1_x86_64.whl.

File metadata

File hashes

Hashes for file-0.2.0-cp34-cp34m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 e373ee1d43b534d18d0f278872ce7422fa38728d92ce8dbc875396a8d924c357
MD5 ddd57096230fb798c2a6b24bada0cbf0
BLAKE2b-256 c63a7782615ce050f11894753d296a5f712c290b1212ca3539a94b64269826ae

See more details on using hashes here.

File details

Details for the file file-0.2.0-cp33-cp33m-manylinux1_x86_64.whl.

File metadata

File hashes

Hashes for file-0.2.0-cp33-cp33m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 fe55000f2678e4a7b98219d77e4028689d04284b692c43bf71831844ea7dac43
MD5 78e073334c0d1a2df661933c6410dc09
BLAKE2b-256 62489ca9c4389bf828ce5d575c7446e390967552f7ba4aed4cedf726669052c3

See more details on using hashes here.

File details

Details for the file file-0.2.0-cp27-cp27mu-manylinux1_x86_64.whl.

File metadata

File hashes

Hashes for file-0.2.0-cp27-cp27mu-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 c9da5bae48f9fe39836f55541aa6dbdaf83256e4043c168f3c4c5b3fb5e7e282
MD5 9c957e5ad307b739aaf8b43918ca524b
BLAKE2b-256 61cf5ae26ab8713fb3cbd83486a9c017efc50455300382b0e66d8fdc1c3e50bf

See more details on using hashes here.

File details

Details for the file file-0.2.0-cp27-cp27m-manylinux1_x86_64.whl.

File metadata

File hashes

Hashes for file-0.2.0-cp27-cp27m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 ef06ae2a730df320bf6f2c9957361c4eb43833af3aefb6d632e67b8e11b14baa
MD5 9e1b9c1de87d08ec91c5315a010d7cb2
BLAKE2b-256 3761f43b9f2786d9e03a0da2f51fb230eb9f03bb3db00fdec42361a42aeec596

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page