Open this example in the interactive library
Source code
import { win32 as path } from "node:path";
console.log(path.relative("C:/assets", "C:/assets/img/a.png"));
Sample output
img\a.png

Open this example in the interactive library
import { win32 as path } from "node:path";
console.log(path.relative("C:/assets", "C:/assets/img/a.png"));
img\a.png