라벨이 base인 게시물 표시

node.js check file, folder path or concatenate path

이미지
 Please read how to initialize npm from this  post. 1. require // Reference : https://nodejs.org/dist/latest-v14.x/docs/api/path.html const path = require ( 'path' ); 2. Base File name console . log ( "The Base File Path" ); console . log ( path . basename ( __filename )); Print the current file name. use '.basename' to console.log the file name. The output type is string. '__filename' is the current file. 3. Directory name console . log ( "The File Directory Path" ); console . log ( path . dirname ( __filename )); Print the current file directory. use '.dirname' to console.log the file directory. The output type is string. 4. File Extension console . log ( " The File Extension" ); console . log ( path . extname ( __filename )); Print the current file extension. use '.extname' to console.log the file extension. The output type is string. 5. Create Path Object console . log ( " \n\n The File Whole Info" );...