Esempio n. 1
0
def mime_type_for_path(path: str) -> str:
    return guess_type(path) or 'application/octet-stream'
Esempio n. 2
0
def scan(d: str) -> Generator[Tuple[str, str], None, None]:
    for dirpath, dirnames, filenames in os.walk(d):
        for f in filenames:
            mt = guess_type(f)
            if mt and mt.startswith('image/'):
                yield os.path.join(dirpath, f), mt
Esempio n. 3
0
def mime_type_for_path(path: str) -> str:
    return guess_type(
        path, allow_filesystem_access=True) or 'application/octet-stream'