Created
December 29, 2018 03:01
-
-
Save jasenmichael/0f1ce0184085069285b9e75b12545ad9 to your computer and use it in GitHub Desktop.
get-file-path-name-ext-javascript created by jasenmichael - https://repl.it/@jasenmichael/get-file-path-name-ext-javascript
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var path = require('path') | |
let file = "path/to/file/file.ext" | |
let filePath = path.dirname(file) | |
let fileName = file.split('.').pop() | |
let fileNameWithExtention = file.split('/').pop() | |
console.log('file: ',file) | |
console.log('filePath: ',filePath) | |
console.log('fileName: ',fileName) | |
console.log('fileNameWithExtention: ',fileNameWithExtention) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment