Accepts a filename and returns the detected filetype. Return value is the mimetype if mime=True, otherwise a human readable name. >>> magic.from_file("testdata/test.pdf", mime=True) 'application/pdf'
(filename, mime=False)
| 167 | |
| 168 | |
| 169 | def from_file(filename, mime=False): |
| 170 | """" |
| 171 | Accepts a filename and returns the detected filetype. Return |
| 172 | value is the mimetype if mime=True, otherwise a human readable |
| 173 | name. |
| 174 | |
| 175 | >>> magic.from_file("testdata/test.pdf", mime=True) |
| 176 | 'application/pdf' |
| 177 | """ |
| 178 | m = _get_magic_type(mime) |
| 179 | return m.from_file(filename) |
| 180 | |
| 181 | |
| 182 | def from_buffer(buffer, mime=False): |
nothing calls this directly
no test coverage detected
searching dependent graphs…