changeExt()
const
changeExt: (filename
,ext
,ignoreExts?
,maxSize?
) =>string
=upath.changeExt
Changes a filename's extension to ext. If it has no (valid) extension, it adds it.
Valid extensions are considered to be up to maxSize chars long, counting the dot (defaults to 7).
An Array of ignoreExts (eg ['.min']) prevents these from being considered as extension, thus are not changed - the new extension is added instead.
Parameters
Parameter | Type | Description |
---|---|---|
|
|
string filename to change it's extension |
|
|
string extension to change to |
|
|
array extensions to ignore |
|
|
number max length of the extension |
Returns
string