6. Common Core Module require('path')
03
NOTICE,
path.dirname(__filename) is the same thing
as __dirname
There are multiple way to get to info.
'path' gives us more info to access
const os = require('os') const path = require('path') console.log(__dirname) console.log(path.dirname(__filename))
02
We pass in arguments
from other modules like os.homedir()(os ) or global variables
like __filename into path's methods via
the ()'s.
const os = require('os') const path = require('path') const home_dir = os.homedir() console.log( path.dirname(home_dir) console.log() console.log(path.dirname(__filename)) console.log(path.basename(__filename)) console.log(path.extname(__filename))
01
The methods from the Common Core Module
path, give us access to more detais.
const os = require('path') console.log(path)