Method description:
Returns the path file extension. If path ends with '.', '.' will be returned. If there is no extension and does not end with '.', a null value will be returned.
grammar:
The code copy is as follows:
path.extname(p)
Since this method belongs to the path module, you need to introduce the path module before use (var path= require("path") )
Receive parameters:
p path
example:
The code copy is as follows:
path.extname('index.html')
// returns
'.html'
path.extname('index.')
// returns
'.'
path.extname('index')
// returns
''
Source code:
The code copy is as follows:
exports.extname = function(path) {
return splitPath(path)[3];
};