node-samba-client
Node.js wrapper for smbclient
Requirements
Requires Node.js 10+
Smbclient must be installed. This can be installed on Ubuntu with sudo apt-get install smbclient
.
API
const SambaClient = require('samba-client');
let client = new SambaClient({
address: '//server/folder',
username: 'test',
password: 'test',
domain: 'WORKGROUP',
maxProtocol: 'SMB3',
maskCmd: true,
});
await client.sendFile('somePath/file', 'destinationFolder/name');
await client.getFile('someRemotePath/file', 'destinationFolder/name');
await client.mkdir('folder/tree', (optional) 'current/working/directory');
await client.dir('remote/folder', (optional) 'current/working/directory');
await client.fileExists('remote/file', (optional) 'current/working/directory');
Troubleshooting
Error: spawn ENOTDIR in Electron
Pass an empty string in the Current Working Directory parameter, for more information see this PR.