Access file from network share path in nodejs
I figure I might as well just mount it and access it like local file.
for Linux server, I used smbmount
.
In Ubuntu try the cifs-utils
package to mount the smb-cifs Windows file share to a Linux mount path
sudo apt-get install cifs-utils
mount -t cifs -o username=USERNAME,password=PASSWD //192.168.1.88/shares /mnt/share
and then you can access it in this directory: /mnt/share
In Windows you should be able to access the network path directly. Windows 7 seems to accept forward slashes in place of back slashes for a network path name. Try this:
var path = "//10.1.10.11/Results/filename.rtf";
Did you escape the backslashes?
var path = "\\\\10.1.10.11\\Results\\filename.rtf";
console.log(path);
Above works, but here's a better looking way (that accomplishes the same path without having to double up those backslashes):
let path = String.raw`\\10.1.10.11\Results\filename.rtf`;
console.log(path);
Warning: With this technique, you still have to double up the backslash if the string ends with a backslash.
Doing this, I just had success attaching a file (located on a network share) to an email via node.js (and the nodemailer package). Perhaps this would apply in what you're doing too.