Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/aliles/filemagic
File type identification using libmagic
https://github.com/aliles/filemagic
Last synced: 30 days ago
JSON representation
File type identification using libmagic
- Host: GitHub
- URL: https://github.com/aliles/filemagic
- Owner: aliles
- License: other
- Created: 2011-07-20T12:58:09.000Z (over 13 years ago)
- Default Branch: master
- Last Pushed: 2019-12-11T15:33:47.000Z (about 5 years ago)
- Last Synced: 2024-11-01T00:36:05.930Z (about 1 month ago)
- Language: Python
- Homepage: http://pypi.python.org/pypi/filemagic
- Size: 276 KB
- Stars: 45
- Watchers: 6
- Forks: 10
- Open Issues: 13
-
Metadata Files:
- Readme: README.rst
- Changelog: CHANGELOG
- License: LICENSE
Awesome Lists containing this project
README
filemagic
---------*filemagic* is a ctypes wrapper for `libmagic
`_, the library that supports the *file*
command on most Unix systems. The package provides a simple Python API for
identifying files using the extensive database of magic strings that ships with
*libmagic*.* Documentation for *filemagic* is hosted on `Read the Docs
`_.
* Packages are hosted by the `Python Package Index
`_.*filemagic* has been tested against *libmagic* 5.11. It supports both Python2
and Python3, as well as CPython and PyPy.|build_status| |coverage| |pypi_version|
Example
-------Below is a short snippet of code showing how to use *filemagic* to identifying
this README file. ::>>> import magic
>>> with magic.Magic() as m:
... m.id_filename('setup.py')
...
'ASCII text'It is recommended that *magic.Magic* be used with a context manager (the *with*
statement) to avoid leaking resources from *libmagic* when instances go out of
scope. Otherwise the *close()* method must be called explicitly.Further Reading
---------------Refer to the `filemagic documenation `_ for
further references... |build_status| image:: https://secure.travis-ci.org/aliles/filemagic.png?branch=master
:target: http://travis-ci.org/#!/aliles/filemagic
:alt: Current build status.. |coverage| image:: https://coveralls.io/repos/aliles/filemagic/badge.png?branch=master
:target: https://coveralls.io/r/aliles/filemagic?branch=master
:alt: Coverage status.. |pypi_version| image:: https://pypip.in/v/filemagic/badge.png
:target: https://crate.io/packages/filemagic/
:alt: Latest PyPI version