stbSmb

stbSmb

Tutorials:

Global object to browse Samba servers.
Exists only on supported devices.

Methods

(static) findGroups(callback)

Start scanning to find all available SMB groups.

Example
stbSmb.findGroups(function ( error, data ) {
    if ( !error ) {
        // list of found groups:
        // ['WORKGROUP']
        console.log(data);
    }
});
Parameters:
Name Type Description
callback stbSmb~findGroupsCallback

scan result handler

Throws:

Will throw an error in case of bad input arguments.

(static) findServers(config, callback)

Start group scanning to find all available servers.

Example
stbSmb.findServers({group: 'WORKGROUP'}, function ( error, data ) {
    if ( !error ) {
        // list of found servers:
        // ['john', 'backup', 'ALEX-PC']
        console.log(data);
    }
});
Parameters:
Name Type Description
config Object

scan configuration

Properties
Name Type Description
group string

SMB group to scan

callback stbSmb~findServersCallback

scan result handler

Throws:

Will throw an error in case of bad input arguments.

(static) findShares(config, callback)

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

Examples
// simple request as a guest user
stbSmb.findShares({server: 'john'}, function ( error, data ) {
    if ( !error ) {
        // list of found shares:
        // ['video', 'music']
        console.log(data);
    }
});
// request with authentication
stbSmb.findShares({server: '10.0.0.10', login: 'admin', password: '1234'}, function ( error, data ) {
    if ( !error ) {
        // list of found shares:
        // ['documents', 'data']
        console.log(data);
    }
});
Parameters:
Name Type Description
config Object

scan configuration

Properties
Name Type Attributes Default Description
server string

server name to scan

login string <optional>
guest

server account login

password string <optional>

server account password

callback stbSmb~findSharesCallback

scan result handler

Throws:

Will throw an error in case of bad input arguments.

(static) findIps(config, callback)

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

Example
stbSmb.findIps({server: 'john'}, function ( error, data ) {
    if ( !error ) {
        // resolved server IP:
        // ['192.168.1.56']
        console.log(data);
    }
});
Parameters:
Name Type Description
config Object

scan configuration

Properties
Name Type Description
server string

server name to scan

callback stbSmb~findIpsCallback

scan result handler

Throws:

Will throw an error in case of bad input arguments.

Type Definitions

ErrorResultObject

See:
Properties:
Name Type Description
message string

error description

code number

error code

Error result object.

Type:
  • Object
Example
{
    message: 'some error occurred',
    code: -1,
}

findGroupsCallback(error, data)

Scan result handler.

Parameters:
Name Type Description
error stbSmb~findGroupsCallback | null

scan error message on failure

data Array.<string>

found group list

findServersCallback(error, data)

Scan result handler.

Parameters:
Name Type Description
error stbSmb~ErrorResultObject | null

scan error message on failure

data Array.<string>

found server list

findSharesCallback(error, data)

Scan result handler.

Parameters:
Name Type Description
error stbSmb~ErrorResultObject | null

scan error message on failure

data Array.<string>

share name list

findIpsCallback(error, data)

Scan result handler.

Parameters:
Name Type Description
error stbSmb~ErrorResultObject | null

scan error message on failure

data Array.<string>

share name list