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?
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.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.