라벨이 running인 게시물 표시

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" );...

node.js check how long you run your PC

이미지
  Please read how to initialize npm from this  post. 1. Uptime First, you need to type the 'const os = require('os');' to import the os module. After that type 'console.log(os.uptime());'.  Now run the node to run index.js or index. Enter: need to check your file path - node index.js - node index The number is a second. 2. variable build const variable to put 'os.uptime()' - 'os_time' 3. Divide the number to 3600(using console.log) Now print the number(os_time/3600) to find how long your does your OS run(hour).