The path.sep method in node.js is described

  • 2020-03-30 04:34:06
  • OfStack

Method description:

Converts a string of specified literal delimiters' \' or '/' into an array object.

Grammar:


path.sep

Since this method belongs to the path module, you need to introduce the path module (var path= require(" path ")) before using it.

Receiving parameters:

There is no

Example:


*nix Examples under the system:
'foo/bar/baz'.split(path.sep)
// returns
['foo', 'bar', 'baz']
 
windows Examples under the system
'foo\bar\baz'.split(path.sep)
// returns
['foo', 'bar', 'baz']


Related articles: