These packages are all implemented using pure TypeScript, and they can be easily included in frontend code using bundlers like webpack etc..
Similar to Node.js's path.relative() but works outside the context of a filesystem, and assumes all paths are POSIX-style. So this also works for URL pathnames.
You can easily use this package by installing it in your Node.js project:
> npm install get-relative-path