9951 explained code solutions for 126 technologies


nodejsHow to extract filename from path


const path = require('path');
let file = path.basename('/home/joe/image.png');ctrl + c
require('path')

module to work with file/dir path

.basename(

return filename part of a given path

/home/joe/image.png

sample path to extract filename from