path模块
传入一个路径,处理该路径
const path=require("path"); let pathUrl="D:/workspace/airtest/suite/1.txt"; console.log(path.dirname(pathUrl));//获取目录 D:/workspace/airtest console.log(path.extname(pathUrl));//获取文件后缀 txt console.log(path.basename(pathUrl));//获取文件 1.txt console.log(path.resolve(pathUrl,"../uuu"));//路径拼接 D:workspaceairtestsuiteuuu console.log(path.resolve(__dirname,"www"));//当前源文件所在目录 d:workspace odeday4www