Node.js wrapper for smbclient
Requires Node.js 10+
Smbclient must be installed. This can be installed on Ubuntu with sudo apt-get install smbclient.
constSambaClient=require('samba-client');letclient=newSambaClient({address: '//server/folder',// requiredusername: 'test',// not required, defaults to guestpassword: 'test',// not requireddomain: 'WORKGROUP'// not requiredmaxProtocol: 'SMB3'// not required});// send a fileawaitclient.sendFile('somePath/file','destinationFolder/name');// get a fileawaitclient.getFile('someRemotePath/file','destinationFolder/name');// create a folderawaitclient.mkdir('folder/tree',(optional)'current/working/directory');// By default CWD is __dirname// executes dir command in remote directoryawaitclient.dir('remote/folder',(optional)'current/working/directory');// By default CWD is __dirname// validate if file or folder exists in the remote deviceawaitclient.fileExists('remote/file',(optional)'current/working/directory');// By default CWD is __dirnamePass an empty string in the Current Working Directory parameter, for more information see this PR.