gws.lib.mime

Mime types.

Source code: gws.lib.mime

Package Contents

gws.lib.mime.BIN = 'application/octet-stream'

MIME-Type for files ending in .bin

gws.lib.mime.CSS = 'text/css'

MIME-Type for files ending in .CSS

gws.lib.mime.CSV = 'text/csv'

MIME-Type for files ending in .CSV

gws.lib.mime.GEOJSON = 'application/geojson'

MIME-Type for files ending in .GEOJSON

gws.lib.mime.GIF = 'image/gif'

MIME-Type for files ending in .GIF

gws.lib.mime.GML = 'application/gml+xml'

MIME-Type for files ending in .GML

gws.lib.mime.GML2 = 'application/gml+xml; version=2'

MIME-Type for files ending in .GML2

gws.lib.mime.GML3 = 'application/gml+xml; version=3'

MIME-Type for files ending in .GML3

gws.lib.mime.GZIP = 'application/gzip'

MIME-Type for files ending in .GZIP

gws.lib.mime.HTML = 'text/html'

MIME-Type for files ending in .HTML

gws.lib.mime.JPEG = 'image/jpeg'

MIME-Type for files ending in .JPEG

gws.lib.mime.JS = 'application/javascript'

MIME-Type for files ending in .JS

gws.lib.mime.JSON = 'application/json'

MIME-Type for files ending in .JSON

gws.lib.mime.PDF = 'application/pdf'

MIME-Type for files ending in .PDF

gws.lib.mime.PNG = 'image/png'

MIME-Type for files ending in .PNG

gws.lib.mime.SVG = 'image/svg+xml'

MIME-Type for files ending in .SVG

gws.lib.mime.TTF = 'application/x-font-ttf'

MIME-Type for files ending in .TTF

gws.lib.mime.TXT = 'text/plain'

MIME-Type for files ending in .TXT

gws.lib.mime.XML = 'application/xml'

MIME-Type for files ending in .XML

gws.lib.mime.ZIP = 'application/zip'

MIME-Type for files ending in .ZIP

gws.lib.mime.get(mt: str) str | None

Return the normalized mime type.

Parameters:

mt – Mime type or content type.

Returns:

The normalized mime type.

gws.lib.mime.for_path(path: str) str

Returns the mime type for a given path.

Parameters:

path – Path to mime type.

Returns:

The mime type or BIN if type is unknown.

gws.lib.mime.extension_for(mt: str) str | None

Returns the extension of a given mime type.

Parameters:

mt – Mime type.

Returns:

The mime type extension.