In node.js path module, I have this
var path = require('path');
var filepath = path.join("C:/hello", "/foo/bar");
console.log(filepath);
but it prints out
C:\hello\foo\bar
I expected it to use the slashes direction from the first parameter, which is /
but it used \
. Does anyone how can I can fix this?
If I use the one with \
slashes, and then read from the file using fs
module, I get
{ Error: EISDIR: illegal operation on a directory, open 'C:\main\temp\config
1\folder\plugin\jquery-3.1.1.min.js'
at Error (native)
errno: -4068,
code: 'EISDIR',
syscall: 'open',
path: 'C:\\main\\temp\\config1\\folder\\plugin\\jquery-3.1.1.min.js' }
I'm running on a windows environment btw.
Thanks