Method description:
Extract the last part of the path separated by '/'. (See example for details)
grammar:
The code copy is as follows:
path.basename(p, [ext])
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 to process
ext Characters to filter
example:
The code copy is as follows:
var path= require("path");
path.basename('/foo/bar/baz/asdf/quux.html')
// returns
'quux.html'
path.basename('/foo/bar/baz/asdf/quux.html', '.html')
// returns
'quux'
var a = path.basename('/foo/bar/baz/asdf/', '.html');
// returns
'asdf'