On this page

    P

    path.sep

    History
    Type:string

    Provides the platform-specific path segment separator:

    • \ on Windows
    • / on POSIX

    For example, on POSIX:

    'foo/bar/baz'.split(path.sep);
    // Returns: ['foo', 'bar', 'baz']

    On Windows:

    'foo\\bar\\baz'.split(path.sep);
    // Returns: ['foo', 'bar', 'baz']

    On Windows, both the forward slash (/) and backward slash (\) are accepted as path segment separators; however, the path methods only add backward slashes (\).