mazey
    Preparing search index...

    Function getUrlFileType

    • 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);

      Output:

      png jpg jpeg jpeg ""
      

      Parameters

      • url: string

      Returns string | boolean