In our case we need to operate on already opened and unnamed file (e.g. TemporaryFile created as a werkzeug's FileStorage).
libmagic implements from_descriptor method to use file descriptor as a source, but it's not supported by python-magic wrapper. I've added that functionality in this PR. I hope you like it.
Thanks for great Python binding, it's really useful! ❤️
Thanks, this looks good! It will probably fail on older versions of libmagic that don't have this function, but I'll fix that up in a followup. The test suite will find those.
In our case we need to operate on already opened and unnamed file (e.g. TemporaryFile created as a werkzeug's FileStorage).
libmagic
implementsfrom_descriptor
method to use file descriptor as a source, but it's not supported by python-magic wrapper. I've added that functionality in this PR. I hope you like it.Thanks for great Python binding, it's really useful! ❤️