Open this example in the interactive library
Source code
import { posix as path } from "node:path";
console.log(path.relative("/srv/www", "/srv/assets/icon.svg"));
Sample output
../assets/icon.svg

Open this example in the interactive library
import { posix as path } from "node:path";
console.log(path.relative("/srv/www", "/srv/assets/icon.svg"));
../assets/icon.svg