Fixing a Node.js path gotcha on Windows

I recently ran across a gotcha when working with file paths in Node.js scripts across macOS, Linux and Windows, so sharing details and the solution here in case it helps someone else. TL;DR Problem : When converting file URL objects to absolute path strings, the pathname part works fine on POSIX systems like macOS & Linux, but causes problems on Windows. Solution: Use fileURLToPath() from node:url…