NODE.JS - how to handle a mix of OS and URL-style “paths” correctly?
问题 In my node.js app I have functions which can be passed either OS-style paths e.g. c:\my\docs\mydoc.doc (or /usr/docs/mydoc.doc or whatever is local) File URLS e.g. file://c:/my/docs/mydoc.doc (which I'm not sure about the validity of '\'s in??) Either way, I need to check to see if they refer to a specific location which will always exist as a local OS-style path e.g. c:\mydata\directory\ or /usr/mydata/directory Obviously for OS-style paths I can just compare them as strings - they SHOULD