pathsrc-test

1.0.1 • Public • Published
const path=require("path");
const { dirname, basename, extname } = require("path");


const src="D:/node/npm/path/index.js";
console.log(dirname(src));
console.log(basename(src));
console.log(extname(src));


console.log(__dirname);//__dirname返回文件所在绝对路径,不包含文件本身
console.log(__filename);//__filename返回文件所在的绝对路径,包含文件本身
console.log(path.parse("c:/shen/node/path/index.js"));


let obj={
    root:"c:/",
    dir:"c:/shen/node/path",
    base:"index.js",
    ext:".js",
    name:"index"
}
console.log(path.format(obj));

Readme

Keywords

none

Package Sidebar

Install

npm i pathsrc-test

Weekly Downloads

1

Version

1.0.1

License

ISC

Unpacked Size

1.46 kB

Total Files

3

Last publish

Collaborators

  • hzdnpmzh