Node.js fs module and windows paths
24,492
Yes it does. See more: Writing cross-platform Node.js
Be sure to use path.join
and path.normalize
instead of having explicit path separators (/
, \
, \\
, etc) in your code.
![Alexander Mills](https://i.stack.imgur.com/5Oh7r.jpg?s=256&g=1)
Author by
Alexander Mills
Dev, Devops, soccer coach. https://www.github.com/oresoftware
Updated on July 05, 2022Comments
-
Alexander Mills almost 2 years
Does the Node.js fs module implicitly convert Windows folder path separators from
'\\'
to'/'
?For example, if I use this call on Windows:
fs.readdirSync(dir).forEach(function(file) { });
file argument has
'/'
path separators, not'\\'
, why is that?