node.js check file, folder path or concatenate path
Please read how to initialize npm from this post.
1. require
2. Base File name
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
Print the current file directory. use '.dirname' to console.log the file directory. The output type is string.
4. File Extension
Print the current file extension. use '.extname' to console.log the file extension. The output type is string.
5. Create Path Object
Print the current file path information object. use '.parse' to console.log the file path object. The output type is object.
6. Concatenate
Print the concatenate string. This example print 'Hello_World.txt' path. Concatenate to 'test' folder and add 'Hello_World.txt'. The output type is string.
댓글
댓글 쓰기