Copy files from Samba to node.js folder
1 answer
Assuming the host is Linux (since you mentioned "samba" and not "MS SMB"), you first need to mount the remote server with smbmount
. This forum post has an overview on how to do this , then you just read the files as if they were local to your server.
Alternatively smbget
allows you to purchase individual files without installing a remote host, but not efficient for a lot of file requests.
Other editing; some example code:
var remoteFile = require('child_process').spawn('smbget', ['--stdout', 'smb://host/filename']);
remoteFile.stdout.on('data', function(chunk) {
//handle chunk of data
});
remoteFile.on('exit', function() {
//file loaded completely, continue doing stuff
});
+2
source to share