Get the file extension from a URL or path.
Usage:
import { getUrlFileType } from "mazey";const ret1 = getUrlFileType("https://example.com/a/b/c.png");const ret2 = getUrlFileType("https://example.com/a/b/c.jpg");const ret3 = getUrlFileType("https://example.com/a/b/c.jpeg");const ret4 = getUrlFileType("/a/b/c.jpeg");const ret5 = getUrlFileType("https://example.com/a/b/c.v/a");console.log(ret1, ret2, ret3, ret4, ret5); Copy
import { getUrlFileType } from "mazey";const ret1 = getUrlFileType("https://example.com/a/b/c.png");const ret2 = getUrlFileType("https://example.com/a/b/c.jpg");const ret3 = getUrlFileType("https://example.com/a/b/c.jpeg");const ret4 = getUrlFileType("/a/b/c.jpeg");const ret5 = getUrlFileType("https://example.com/a/b/c.v/a");console.log(ret1, ret2, ret3, ret4, ret5);
Output:
png jpg jpeg jpeg "" Copy
png jpg jpeg jpeg ""
Get the file extension from a URL or path.
Usage:
Output: