Tutorial: Work with Samba servers

Work with Samba servers

Start scanning to find all available SMB groups:

stbSmb.findGroups(function ( error, data ) {
    if ( error ) {
        throw new Error(error);
    }

    // list of found groups:
    console.log(data);
});

Start group scanning to find all available servers:

stbSmb.findServers({group: groupName}, function ( error, data ) {
    if ( error ) {
        throw new Error(error);
    }

    // list of found servers:
    console.log(data);
});

Start scanning to find all available exports on the given server:

stbSmb.findShares(
    {
        server: serverIp,
        login: userName,
        password: userPass
    },
    function ( error, data ) {
        if ( error ) {
            throw new Error(error);
        }

        // list of found shares:
        console.log(data);
    }
);

Resolve IP for the given export name in the specific SMB group:

stbSmb.findIp({server: serverIp}, function ( error, data ) {
     if ( error ) {
        throw new Error(error);
    }

    // resolved server IP:
    console.log(data);
});