1
1
Fork 0
mirror of https://github.com/tonydamage/nux-env.git synced 2025-12-11 13:24:28 +01:00
nux-env/inc/nux.mime.inc.sh
Tony Tkacik e173c4613c Introduced new libraries for mime, thumbnails, labels
Signed-off-by: Tony Tkacik <tonydamage@gmail.com>
2017-07-15 12:10:44 +02:00

22 lines
474 B
Bash

nux.mime() {
local type=binary/octet
local suffix="${1##*.}"
case "${suffix,,}" in
txt) type=text/plain;;
css) type=text/css;;
jpg) type=image/jpeg;;
png) type=image/png;;
zip) type=application/zip;;
cbr) type=application/x-cbz;;
cbz) type=application/x-cbr;;
pdf) type=application/pdf;;
epub) type=application/epub+zip;;
mp4) type=video/mp4;;
*)
if [ -d "$1" ]; then
type=directory
fi
esac
echo $type;
}