jj
    Preparing search index...

    Function fileExt

    • Returns the file extension

      Parameters

      • path: string

        absolute, relative, or URL path to a file

      Returns string

      the extension name in lowercase and without any dot prefix

      This convenience function is primarily used to guess the 'as' attribute of a link preload/prefetch behind the scene.

      fileExt('file.txt') // => 'txt'
      fileExt('https://www.alexewerlof.com/path/to/file.js') // => 'js'

      If path is not a string.