File type identification using libmagic
Project description
actrecipemagicfile (A CFFI fork of python-magic)
actrecipemagicfile is a Python interface to the libmagic file type identification library. libmagic identifies file types by checking their headers against a predefined list. This functionality is accessible from the command line using the Unix command file.
Changelog
[2024-12-04]
New: Added support for Mac Silicon (Python 3.10, 3.11).
New: Added support for Linux ARM (Python 3.10, 3.11, 3.12).
Usage
>>> import magicfile as magic
>>> magic.from_file("testdata/test.pdf")
'PDF document, version 1.2'
>>> magic.from_buffer(open("testdata/test.pdf").read(1024))
'PDF document, version 1.2'
>>> magic.from_file("testdata/test.pdf", mime=True)
'application/pdf'
There is also a Magic class that provides more direct control,
including overriding the magic database file and turning on character
encoding detection. This is not recommended for general use. In
particular, it's not safe for sharing across multiple threads and
will fail throw if this is attempted.
>>> f = magic.Magic(uncompress=True)
>>> f.from_file('testdata/test.gz')
'ASCII text (gzip compressed data, was "test", last modified: Sat Jun 28
21:32:52 2008, from Unix)'
You can also combine the flag options:
>>> f = magic.Magic(mime=True, uncompress=True)
>>> f.from_file('testdata/test.gz')
'text/plain'
License
actrecipemagicfile is distributed under the MIT license. See the included
LICENSE file for details.
Notes:
- This package is primarily used in an internal project.
- Support for Mac Silicon and Linux ARM is effective from 2024-12-04.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file actrecipemagicfile-0.4.32-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: actrecipemagicfile-0.4.32-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 637.5 kB
- Tags: CPython 3.12, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.10.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0c0ba4c21c9e299b31599b0f3a31ddb3983e829e1d5d6df2b3a8adeda7c6cf25
|
|
| MD5 |
c4082304006333355e31dcfd3697a341
|
|
| BLAKE2b-256 |
27ea7aacc4e56d39460201ddd4e6079016449e59ec9e62ed21cac1ef435ca496
|
File details
Details for the file actrecipemagicfile-0.4.32-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.
File metadata
- Download URL: actrecipemagicfile-0.4.32-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
- Upload date:
- Size: 640.1 kB
- Tags: CPython 3.12, manylinux: glibc 2.17+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.11.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
106b2aab57bd0d28bd1dbf6054f2c1b64a6b28f253149e474714221c21622631
|
|
| MD5 |
5cb5e07a901799cde5abff4166879c00
|
|
| BLAKE2b-256 |
d3325c9e6e1e435dae39ccc7faa196df5eb0f58803738395ce9c94d17cb6bb8e
|
File details
Details for the file actrecipemagicfile-0.4.32-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: actrecipemagicfile-0.4.32-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 637.1 kB
- Tags: CPython 3.11, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.10.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1c9adc5073a24ef9947e3c6d3f682241d1831347a3d3b18408613acf4d7feaab
|
|
| MD5 |
cc837a50aa0849916160a2abb29f6d63
|
|
| BLAKE2b-256 |
07b99f365be8ca7171ca5f78533b645409d7de60283f758205be74d97a6ca745
|
File details
Details for the file actrecipemagicfile-0.4.32-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.
File metadata
- Download URL: actrecipemagicfile-0.4.32-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
- Upload date:
- Size: 639.8 kB
- Tags: CPython 3.11, manylinux: glibc 2.17+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.11.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8a5e271cb3dc0ab4015622a2e6826e1b0a5d7d825dd3a279ef81aedf35ab9914
|
|
| MD5 |
f7381098b95ba631478a6ea3fd2e994d
|
|
| BLAKE2b-256 |
7796eeb5692d8d9930ded60e22b0dc043388f2e8c72fe5d10abdb7cf76fdc2b0
|
File details
Details for the file actrecipemagicfile-0.4.32-cp311-cp311-macosx_13_0_universal2.whl.
File metadata
- Download URL: actrecipemagicfile-0.4.32-cp311-cp311-macosx_13_0_universal2.whl
- Upload date:
- Size: 492.2 kB
- Tags: CPython 3.11, macOS 13.0+ universal2 (ARM64, x86-64)
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.11.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bd85bc60040207eb36f64669549d1a082c7c0ec0efe94f5208b5050f213f5b82
|
|
| MD5 |
f29392c536c4e02afcfb0448000af71a
|
|
| BLAKE2b-256 |
ab6264328412f45cdc430c5d9d1b105a7df3e5d2c7c93d5bbab0e81ccf8dddd8
|
File details
Details for the file actrecipemagicfile-0.4.32-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: actrecipemagicfile-0.4.32-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 637.1 kB
- Tags: CPython 3.10, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.11.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2d588ae8461ab477244512fec4c4c75647349e80019147087acaafdca8ec2b1b
|
|
| MD5 |
7639c1ab09c5b546b1bd842ae9ae4d4d
|
|
| BLAKE2b-256 |
d39b8d2c73e02cff6607c1cad53e0510355326873bc0fad31ff3b49952df49ac
|
File details
Details for the file actrecipemagicfile-0.4.32-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.
File metadata
- Download URL: actrecipemagicfile-0.4.32-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
- Upload date:
- Size: 639.8 kB
- Tags: CPython 3.10, manylinux: glibc 2.17+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.11.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
33b4c863e3886b8977116a0579b41a2dc5c0ad3c7e641d1357eb8633dfb53113
|
|
| MD5 |
39e57d27b6e669e50cfd668d002c146f
|
|
| BLAKE2b-256 |
ce80cce4b32108983a9c750a88ff6d7bc6f61e02d3fb8cd4eaa15858d3f9e25f
|
File details
Details for the file actrecipemagicfile-0.4.32-cp310-cp310-macosx_13_0_x86_64.whl.
File metadata
- Download URL: actrecipemagicfile-0.4.32-cp310-cp310-macosx_13_0_x86_64.whl
- Upload date:
- Size: 487.0 kB
- Tags: CPython 3.10, macOS 13.0+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.10.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
dbbf38e255f7b1741188441863cba7b44cec17517a15438a87854a5a9df1d403
|
|
| MD5 |
8473712298a99cf7e08e98b382348399
|
|
| BLAKE2b-256 |
b1eb7813bac049cd41d5dfa5f0996b934b9c601bc269ea972b67f4ec3cbfd6b9
|
File details
Details for the file actrecipemagicfile-0.4.32-cp310-cp310-macosx_13_0_universal2.whl.
File metadata
- Download URL: actrecipemagicfile-0.4.32-cp310-cp310-macosx_13_0_universal2.whl
- Upload date:
- Size: 492.2 kB
- Tags: CPython 3.10, macOS 13.0+ universal2 (ARM64, x86-64)
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.10.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b74408e98d564a113e34fcff9cca73be4cabf84482a804b5988cb574755b6ef9
|
|
| MD5 |
6f73d525363c8111713019f7e22f9099
|
|
| BLAKE2b-256 |
ad969b3371e05a3925e28cdf5c12ed701bd5c0ea437a68ce5e1f0f095ba4e373
|
File details
Details for the file actrecipemagicfile-0.4.32-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: actrecipemagicfile-0.4.32-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 637.1 kB
- Tags: CPython 3.9, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.10.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
be8fe6e12e860e8894f0615556f198dbb06fb2e49153049c6cd893a9f022a4a5
|
|
| MD5 |
8c31d744be14fd9a143bda4bcbd7bade
|
|
| BLAKE2b-256 |
274f1a623a47ed9e0674c14ae60adf7afa4fca2e23b1e28641aab7724c19def9
|
File details
Details for the file actrecipemagicfile-0.4.32-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.
File metadata
- Download URL: actrecipemagicfile-0.4.32-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
- Upload date:
- Size: 639.8 kB
- Tags: CPython 3.9, manylinux: glibc 2.17+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.11.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0a9888f53789fe27fef99884a42a13ee44f1d0be5cfab9ffb66a1b5cc202346d
|
|
| MD5 |
6825e118b749795f4bd56762ff0b1e20
|
|
| BLAKE2b-256 |
2fb2ba8cef5b72afa7c0ac3bdfbb8b721ac3ce05fa504ef73d22b600151b4ff2
|
File details
Details for the file actrecipemagicfile-0.4.32-cp39-cp39-macosx_13_0_x86_64.whl.
File metadata
- Download URL: actrecipemagicfile-0.4.32-cp39-cp39-macosx_13_0_x86_64.whl
- Upload date:
- Size: 487.0 kB
- Tags: CPython 3.9, macOS 13.0+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.9.20
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
efb8fac4271094001b52803610ac0929d9cd0be871d7c469f4ec39694a5ba78a
|
|
| MD5 |
7c359576b6af5789c0070fcaf346cbc9
|
|
| BLAKE2b-256 |
b964d03d0aa6eb3a460c4c1051496ddf49c444d1d406b750e211ab6cfbf8a60d
|
File details
Details for the file actrecipemagicfile-0.4.32-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: actrecipemagicfile-0.4.32-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 637.2 kB
- Tags: CPython 3.8, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.10.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c3ce0021d93c165718395eca9475bbdf9601bd88faff69faec068362a8a40ecf
|
|
| MD5 |
301d5038a9740976046cf508e731a016
|
|
| BLAKE2b-256 |
b52147cbc9770ecf2ad0a0b9def7cef150499f1bdadfb7f8fe1509f42c12a832
|
File details
Details for the file actrecipemagicfile-0.4.32-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.
File metadata
- Download URL: actrecipemagicfile-0.4.32-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
- Upload date:
- Size: 640.0 kB
- Tags: CPython 3.8, manylinux: glibc 2.17+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.11.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a7fecbe62a9714583e4372189b05f5fab8e2ddccd9acd1c03659aa3028d614a0
|
|
| MD5 |
df817dd21ada3c5974eb3ff93d2fcc5d
|
|
| BLAKE2b-256 |
498a706ee7b86756fbbe9d55cb1c1e31de755a4abc541052cef16b19080a761b
|
File details
Details for the file actrecipemagicfile-0.4.32-cp38-cp38-macosx_13_0_x86_64.whl.
File metadata
- Download URL: actrecipemagicfile-0.4.32-cp38-cp38-macosx_13_0_x86_64.whl
- Upload date:
- Size: 487.0 kB
- Tags: CPython 3.8, macOS 13.0+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.8.18
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
aaf32e0ab621b9d2943f595275331b9be9806ab8fd217ec6d25aa4b5ccace026
|
|
| MD5 |
11da28da1caf023f9a6dac880885bd81
|
|
| BLAKE2b-256 |
5d7c3abd1dddf7c0b5dc8a79049677318664a70575368676416df6286f99b5d5
|
File details
Details for the file actrecipemagicfile-0.4.32-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: actrecipemagicfile-0.4.32-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 637.0 kB
- Tags: CPython 3.7m, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.10.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e1a020a7e16027bb7d574776a7265a301e376679b12266b69768f4de5460d25e
|
|
| MD5 |
6080ea2a345738d3c545b64f991a80eb
|
|
| BLAKE2b-256 |
b9e34e148b74cde2c46bdba2e875d16f064c04b8a5029ca1f80b9f4c4cde5ccd
|
File details
Details for the file actrecipemagicfile-0.4.32-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.
File metadata
- Download URL: actrecipemagicfile-0.4.32-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
- Upload date:
- Size: 639.7 kB
- Tags: CPython 3.7m, manylinux: glibc 2.17+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.11.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
eb07bedbc1742a41c81c78d9fa86c7580a23434333c39cb41eef32773141a7f7
|
|
| MD5 |
33d2492a470a64371dab5d9bd14ec5b0
|
|
| BLAKE2b-256 |
b2a31e04f2402087833b992fe20e795c0f86e00d14f1de87a0e6d3c91c73f69d
|
File details
Details for the file actrecipemagicfile-0.4.32-cp36-cp36m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: actrecipemagicfile-0.4.32-cp36-cp36m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 637.0 kB
- Tags: CPython 3.6m, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.8.18
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e337ef54f5c017f3ea313eeadcf1da7b131262c885e24992ce99e37d7214d179
|
|
| MD5 |
ee083d59ebc08d45e3e2e32334b93537
|
|
| BLAKE2b-256 |
52eb246dd8523b26341ca1486ce4117c654fc413ee97f02bae4ee8f733e171bc
|
File details
Details for the file actrecipemagicfile-0.4.32-cp36-cp36m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.
File metadata
- Download URL: actrecipemagicfile-0.4.32-cp36-cp36m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
- Upload date:
- Size: 639.7 kB
- Tags: CPython 3.6m, manylinux: glibc 2.17+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.11.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9a5a60444e94d2740a70a781ecf24df78cfdf7092438c7c82459b43f839511f3
|
|
| MD5 |
138ffb133f5b3cd58e34bed5caa28632
|
|
| BLAKE2b-256 |
c75be501cd56dd06445605c22455b4d0e4e35b6891d29668e1d7005de62329da
|