Learn Simpli

Free Online Tutorial For Programmers, Contains a Solution For Question in Programming. Quizzes and Practice / Company / Test interview Questions.

Path module in nodeJS

The path module provides utilities for working with file and directory paths
console.log(path.posix.basename('/os.js'));
console.log(path.dirname('/os.js'));
console.log(path.extname('os.js'));
console.log(path.isAbsolute('os.js'));
console.log(path.normalize('os.js/..'));
console.log(path.parse('os.js'));
// os.js
// /
// .js
// false
// .
// { root: '', dir: '', base: 'os.js', ext: '.js', name: 'os' }