Reputation: 7237
The path looks like this
\\10.1.10.11\Results\\filename.rtf
From my machine, i can access it just fine by pasting it to Run
box, enter username and password.
I've tried smb2
(smb2) but the sample code just hangs and after awhile, I get Error: read ECONNRESET
.
I need to make this works on both linux and windows.
Upvotes: 16
Views: 32319
Reputation: 11354
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.
Upvotes: 24
Reputation: 12062
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";
Upvotes: 3
Reputation: 7237
I figure I might as well just mount it and access it like local file.
for Linux server, I used smbmount
.
Upvotes: 3