shared
utils
string
object
is
extension
js
tracking
string
dom
when
selection
position
iframe
event
scroll
console
node
string
project
fs
console
checkPathWithMultipleExtensions
Type:Function
Status:stable
Since:1.0.0
Platform:node
@blackbyte.sugar.node.fs
This function take a path and some extensions to check if a file exists with one of these particular extensions. If a file exists, the function return the path with the first extensions that matches
Params
- path*-String
The file path you want to check. With or without an extension
- extensions*-Array<String>
The extensions (without the dot) you want to check
Return
- -String|undefined
The first valid path founded, or undefined
Example
import { checkPathWithMultipleExtensions } from '@blackbyte/sugar/fs';
checkPathWithMultipleExtensions('/my/cool/file.txt', ['txt','js','css']);Author
- Olivier Bosselolivier.bossel@gmail.comhttps://blackbyte.space