Platform independent escaping of spaces in files and paths


I have a package that shells out to git log with a file name that might contain spaces in the path. I kinda foolishly thought for certain this was something node Path would have, but didn’t see it and Path.normalize() leaves spaces.

Otherwise, it’s no big deal right replace(/ /g, '^ ') on windows or replace(/ /g, '\ ') everywhere else?

Can someone on windows please open a console and tell me what process.platform returns :slight_smile:


I’m pretty sure it is win32. Double-checking …

Yes, it should be win32.


Thanks Lee!