demo_path.js:
var path = require('path'); var filename = path.basename('/Users/Refsnes/demo_path.js'); console.log(filename);
C:\Users\My Name>node demo_path.js
demo_path.js