how to get file extension in file path name in nodejs code example Example: node js get file name without extension filename.split('.').slice(0, -1).join('.')