8 lines
236 B
JavaScript
8 lines
236 B
JavaScript
const path=require('path');
|
|
const testPath='f:code/node/chenxuan.js'
|
|
|
|
console.log(path.basename(testPath))
|
|
|
|
// 传入第二个参数后会剥离后缀名,一般用于修改文件后缀
|
|
console.log(path.basename(testPath,'.js')+'.ts')
|