1. 程式人生 > >node——獲取URL路徑副檔名

node——獲取URL路徑副檔名

使用path模組的extname方法可以返回檔案的副檔名

var path = require('path');
console.log(path.extname('123.txt'));  //.txt