Path module in node js
Today we will explore path module in node js. As the name suggests this module gives you the path. We started with fs module , then we went to os module & now moving towards path module. Using path module we can find directory name , filename on which we are working etc. I will cover the important part , for the detail information I will provide the documentation link. One thing, we need to always remember that, whenever we are using node modules we need to require it first . We saw fs & os modules as well, in that also we required the module first & then started playing around with it. To require path module const path = require( 'path' ); So we have required our module, let's play with it now. To get directory name path.dirname(path of file); A typeError is thrown if path of file is not string. To get extension of file path.extname(path of file); To get directory name, root,filename,basename & extension ...