How to get the path object information in Node.js

1 Answer

0 votes
const path = require('path');

const pathObject = path.parse(__filename);

console.log(pathObject);

     
   
/*
run:
   
{
  root: 'c:\\',
  dir: 'c:\\JavaScript',
  base: 'app.js',
  ext: '.js',
  name: 'app'
}
   
*/

 



answered Mar 1, 2020 by avibootz

Related questions

...