actrecipemagicfile


Nameactrecipemagicfile JSON
Version 0.4.31 PyPI version JSON
download
home_pagehttps://github.com/tho-actrecipe/magicfile
SummaryFile type identification using libmagic
upload_time2024-01-12 05:47:46
maintainer
docs_urlNone
authorActRecipe Inc.
requires_python>=3.8
licenseMIT
keywords mime magic file
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # actrecipemagicfile (A CFFI fork of python-magic)
[![PyPI version](https://badge.fury.io/py/actrecipemagicfile.svg)](https://badge.fury.io/py/actrecipemagicfile)

`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`.

## Usage

```python
>>> 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.

```python
>>> 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:

```python
>>> 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.

Note: This package is mostly used in an internal project.


            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/tho-actrecipe/magicfile",
    "name": "actrecipemagicfile",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": "",
    "keywords": "mime magic file",
    "author": "ActRecipe Inc.",
    "author_email": "actrecipe-dev@actrecipe.com",
    "download_url": "",
    "platform": null,
    "description": "# actrecipemagicfile (A CFFI fork of python-magic)\n[![PyPI version](https://badge.fury.io/py/actrecipemagicfile.svg)](https://badge.fury.io/py/actrecipemagicfile)\n\n`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`.\n\n## Usage\n\n```python\n>>> import magicfile as magic\n>>> magic.from_file(\"testdata/test.pdf\")\n'PDF document, version 1.2'\n>>> magic.from_buffer(open(\"testdata/test.pdf\").read(1024))\n'PDF document, version 1.2'\n>>> magic.from_file(\"testdata/test.pdf\", mime=True)\n'application/pdf'\n```\n\nThere is also a `Magic` class that provides more direct control,\nincluding overriding the magic database file and turning on character\nencoding detection.  This is not recommended for general use.  In\nparticular, it's not safe for sharing across multiple threads and\nwill fail throw if this is attempted.\n\n```python\n>>> f = magic.Magic(uncompress=True)\n>>> f.from_file('testdata/test.gz')\n'ASCII text (gzip compressed data, was \"test\", last modified: Sat Jun 28\n21:32:52 2008, from Unix)'\n```\n\nYou can also combine the flag options:\n\n```python\n>>> f = magic.Magic(mime=True, uncompress=True)\n>>> f.from_file('testdata/test.gz')\n'text/plain'\n```\n\n## License\n\n`actrecipemagicfile` is distributed under the MIT license.  See the included\nLICENSE file for details.\n\nNote: This package is mostly used in an internal project.\n\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "File type identification using libmagic",
    "version": "0.4.31",
    "project_urls": {
        "Homepage": "https://github.com/tho-actrecipe/magicfile"
    },
    "split_keywords": [
        "mime",
        "magic",
        "file"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "b7b5da808ff7b89cab3fdb17da2a0f4e222173bf1f1473c8818993017dbae5ef",
                "md5": "c78be65b2fc3b88dfa3f256edf2cfe33",
                "sha256": "7903a432934077ca6c0cece364d9aa78acda611ae2b6710e5f8ec2aa02fa3181"
            },
            "downloads": -1,
            "filename": "actrecipemagicfile-0.4.31-cp310-cp310-macosx_11_0_x86_64.whl",
            "has_sig": false,
            "md5_digest": "c78be65b2fc3b88dfa3f256edf2cfe33",
            "packagetype": "bdist_wheel",
            "python_version": "cp310",
            "requires_python": ">=3.8",
            "size": 494011,
            "upload_time": "2024-01-12T05:47:46",
            "upload_time_iso_8601": "2024-01-12T05:47:46.768958Z",
            "url": "https://files.pythonhosted.org/packages/b7/b5/da808ff7b89cab3fdb17da2a0f4e222173bf1f1473c8818993017dbae5ef/actrecipemagicfile-0.4.31-cp310-cp310-macosx_11_0_x86_64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "16b95ecd93d702d9c2f486c8b2f70af19a1cbdc044fb8568e539d03e2db82e07",
                "md5": "4449e49b2f1b1228509247db00244ba0",
                "sha256": "59d39a7abac07b3978aa2ad483e984475fb99f0840b73f5eae5e6613e394a7e5"
            },
            "downloads": -1,
            "filename": "actrecipemagicfile-0.4.31-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
            "has_sig": false,
            "md5_digest": "4449e49b2f1b1228509247db00244ba0",
            "packagetype": "bdist_wheel",
            "python_version": "cp310",
            "requires_python": ">=3.8",
            "size": 636980,
            "upload_time": "2024-01-12T05:48:07",
            "upload_time_iso_8601": "2024-01-12T05:48:07.548536Z",
            "url": "https://files.pythonhosted.org/packages/16/b9/5ecd93d702d9c2f486c8b2f70af19a1cbdc044fb8568e539d03e2db82e07/actrecipemagicfile-0.4.31-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "bfebb80dcd1eb0b21897172902292358d2720a426c8f9144adb7a6399daa24b3",
                "md5": "80e022d7a3885a1ad7c0a3de9c7f278b",
                "sha256": "b2845daaaddc9e42cd8f865809728a1e183ab1bb42f54a6dd5261db71d253784"
            },
            "downloads": -1,
            "filename": "actrecipemagicfile-0.4.31-cp311-cp311-macosx_10_9_universal2.whl",
            "has_sig": false,
            "md5_digest": "80e022d7a3885a1ad7c0a3de9c7f278b",
            "packagetype": "bdist_wheel",
            "python_version": "cp311",
            "requires_python": ">=3.8",
            "size": 499422,
            "upload_time": "2024-01-12T05:48:15",
            "upload_time_iso_8601": "2024-01-12T05:48:15.989515Z",
            "url": "https://files.pythonhosted.org/packages/bf/eb/b80dcd1eb0b21897172902292358d2720a426c8f9144adb7a6399daa24b3/actrecipemagicfile-0.4.31-cp311-cp311-macosx_10_9_universal2.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "2b98fb7d1abaedc076e1ac6ad5e4ffe8a7e34d5d3ae86ca21e1fed584057e9a6",
                "md5": "a7560bda142681a1445d6ddc17d2b4e9",
                "sha256": "149e594f94d641f3f92abe20eeca1b9392a8d751b1559d9ee729c9b0419a4b4d"
            },
            "downloads": -1,
            "filename": "actrecipemagicfile-0.4.31-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
            "has_sig": false,
            "md5_digest": "a7560bda142681a1445d6ddc17d2b4e9",
            "packagetype": "bdist_wheel",
            "python_version": "cp311",
            "requires_python": ">=3.8",
            "size": 636993,
            "upload_time": "2024-01-12T05:48:09",
            "upload_time_iso_8601": "2024-01-12T05:48:09.197161Z",
            "url": "https://files.pythonhosted.org/packages/2b/98/fb7d1abaedc076e1ac6ad5e4ffe8a7e34d5d3ae86ca21e1fed584057e9a6/actrecipemagicfile-0.4.31-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "09b0ec2351c091bcf4cf767e0034e22d4b81f870b2b535b547b42f487b9b6eb3",
                "md5": "bc408fa856a9e7de92e80da20a94e30b",
                "sha256": "e4969576735cf415d9b1799e98f464993d98be2c2ef17042f7ea54a7bffdc046"
            },
            "downloads": -1,
            "filename": "actrecipemagicfile-0.4.31-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
            "has_sig": false,
            "md5_digest": "bc408fa856a9e7de92e80da20a94e30b",
            "packagetype": "bdist_wheel",
            "python_version": "cp312",
            "requires_python": ">=3.8",
            "size": 637356,
            "upload_time": "2024-01-12T05:48:11",
            "upload_time_iso_8601": "2024-01-12T05:48:11.005495Z",
            "url": "https://files.pythonhosted.org/packages/09/b0/ec2351c091bcf4cf767e0034e22d4b81f870b2b535b547b42f487b9b6eb3/actrecipemagicfile-0.4.31-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "26625a0f8a2305526675976c5591c77a9b379d70751a9c86ccc34b06a81bbf95",
                "md5": "e1f2ec116c646ff825be47b6ebc4aabc",
                "sha256": "29494e6dccfb8dea55e5b9f549316173642239a98b01b2bb59ed7f9ac270b759"
            },
            "downloads": -1,
            "filename": "actrecipemagicfile-0.4.31-cp36-cp36m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
            "has_sig": false,
            "md5_digest": "e1f2ec116c646ff825be47b6ebc4aabc",
            "packagetype": "bdist_wheel",
            "python_version": "cp36",
            "requires_python": ">=3.8",
            "size": 636883,
            "upload_time": "2024-01-12T05:48:12",
            "upload_time_iso_8601": "2024-01-12T05:48:12.808765Z",
            "url": "https://files.pythonhosted.org/packages/26/62/5a0f8a2305526675976c5591c77a9b379d70751a9c86ccc34b06a81bbf95/actrecipemagicfile-0.4.31-cp36-cp36m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "a601495e944361cc48ab418a216b13d245ada183e12a16093366f5b82ecfdea2",
                "md5": "14afe2635f3d2489ebef8484c68000f9",
                "sha256": "3810688b2150ffe26ef3fcf7128078a255d569e2878fe774e8227adf27756f0c"
            },
            "downloads": -1,
            "filename": "actrecipemagicfile-0.4.31-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
            "has_sig": false,
            "md5_digest": "14afe2635f3d2489ebef8484c68000f9",
            "packagetype": "bdist_wheel",
            "python_version": "cp37",
            "requires_python": ">=3.8",
            "size": 636874,
            "upload_time": "2024-01-12T05:48:14",
            "upload_time_iso_8601": "2024-01-12T05:48:14.559317Z",
            "url": "https://files.pythonhosted.org/packages/a6/01/495e944361cc48ab418a216b13d245ada183e12a16093366f5b82ecfdea2/actrecipemagicfile-0.4.31-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "d529be7651fa6078481f18da0697c2c69cc1c044afd726a23a15a313f00a6e1a",
                "md5": "0bb0e9647227b7e15c37cdd1c2bae902",
                "sha256": "e4276740224e42f5f4a63e9afd15bbec55a4f40036e89e1244d27bd9e9ea1b5c"
            },
            "downloads": -1,
            "filename": "actrecipemagicfile-0.4.31-cp38-cp38-macosx_11_0_x86_64.whl",
            "has_sig": false,
            "md5_digest": "0bb0e9647227b7e15c37cdd1c2bae902",
            "packagetype": "bdist_wheel",
            "python_version": "cp38",
            "requires_python": ">=3.8",
            "size": 494002,
            "upload_time": "2024-01-12T05:47:45",
            "upload_time_iso_8601": "2024-01-12T05:47:45.898108Z",
            "url": "https://files.pythonhosted.org/packages/d5/29/be7651fa6078481f18da0697c2c69cc1c044afd726a23a15a313f00a6e1a/actrecipemagicfile-0.4.31-cp38-cp38-macosx_11_0_x86_64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "70ed78c98fa983434d477264267a8a0f8c0fb2afeb0d79a489fbb5514050ab45",
                "md5": "f675506695f51558e48e8806d4b8eb13",
                "sha256": "22a59f18fdee8cd56c74379ab62e9c37333845e1537b1713d5c0e5412e084a73"
            },
            "downloads": -1,
            "filename": "actrecipemagicfile-0.4.31-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
            "has_sig": false,
            "md5_digest": "f675506695f51558e48e8806d4b8eb13",
            "packagetype": "bdist_wheel",
            "python_version": "cp38",
            "requires_python": ">=3.8",
            "size": 637105,
            "upload_time": "2024-01-12T05:48:16",
            "upload_time_iso_8601": "2024-01-12T05:48:16.197213Z",
            "url": "https://files.pythonhosted.org/packages/70/ed/78c98fa983434d477264267a8a0f8c0fb2afeb0d79a489fbb5514050ab45/actrecipemagicfile-0.4.31-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "c44a60a0f50320edeb30e7b6f17cc0e441b6f660bf9e2f2315d780b9b95a9a1d",
                "md5": "a96eb07abf751b43c71e341b26a9b9fe",
                "sha256": "b82c707e9251cf42732615d945d113e70a05f7f4536d2dddb173eded744c55cb"
            },
            "downloads": -1,
            "filename": "actrecipemagicfile-0.4.31-cp39-cp39-macosx_11_0_x86_64.whl",
            "has_sig": false,
            "md5_digest": "a96eb07abf751b43c71e341b26a9b9fe",
            "packagetype": "bdist_wheel",
            "python_version": "cp39",
            "requires_python": ">=3.8",
            "size": 494019,
            "upload_time": "2024-01-12T05:47:46",
            "upload_time_iso_8601": "2024-01-12T05:47:46.951849Z",
            "url": "https://files.pythonhosted.org/packages/c4/4a/60a0f50320edeb30e7b6f17cc0e441b6f660bf9e2f2315d780b9b95a9a1d/actrecipemagicfile-0.4.31-cp39-cp39-macosx_11_0_x86_64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "d72ae8906fb8d497e37b61c617a6ef7d3d2e43da2421da9a78b2e5e08ab446c6",
                "md5": "ef8bc16068e5d873f3ea66a12f000a35",
                "sha256": "9f1d930704d39b181ef8d0a77d7c9e9c794905e1d3abbc131150151d07e00f9b"
            },
            "downloads": -1,
            "filename": "actrecipemagicfile-0.4.31-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
            "has_sig": false,
            "md5_digest": "ef8bc16068e5d873f3ea66a12f000a35",
            "packagetype": "bdist_wheel",
            "python_version": "cp39",
            "requires_python": ">=3.8",
            "size": 636973,
            "upload_time": "2024-01-12T05:48:18",
            "upload_time_iso_8601": "2024-01-12T05:48:18.980584Z",
            "url": "https://files.pythonhosted.org/packages/d7/2a/e8906fb8d497e37b61c617a6ef7d3d2e43da2421da9a78b2e5e08ab446c6/actrecipemagicfile-0.4.31-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-01-12 05:47:46",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "tho-actrecipe",
    "github_project": "magicfile",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "tox": true,
    "lcname": "actrecipemagicfile"
}
        
Elapsed time: 0.75865s