On this page

    path.relative(from, to): string
    Attributes
    from:string
    Returns:string

    The path.relative() method returns the relative path from from to to based on the current working directory. If from and to each resolve to the same path (after calling path.resolve() on each), a zero-length string is returned.

    If a zero-length string is passed as from or to, the current working directory will be used instead of the zero-length strings.

    For example, on POSIX:

    path.relative('/data/orandea/test/aaa', '/data/orandea/impl/bbb');
    // Returns: '../../impl/bbb'

    On Windows:

    path.relative('C:\\orandea\\test\\aaa', 'C:\\orandea\\impl\\bbb');
    // Returns: '..\\..\\impl\\bbb'

    A TypeError is thrown if either from or to is not a string.