demo_met_path_basename2.js:
var path = require('path'); //Extract the filename, but leave the file extension: var filename = path.basename('/Users/Refsnes/demo_path.js', '.js'); console.log(filename);
C:\Users\My Name>node demo_met_path_basename2.js
demo_path