Answers for "path.basename nodejs"

7

path.basename nodejs

/* The path.basename() method returns the last portion of a path,
similar to the Unix basename command. Trailing directory separators
are ignored, see path.sep. */

path.basename('/foo/bar/baz/asdf/quux.html');
// Returns: 'quux.html'

path.basename('/foo/bar/baz/asdf/quux.html', '.html');
// Returns: 'quux'
Posted by: Guest on May-03-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language