new SshCommand(command [, data])
Constructor.
Parameters:
Name | Type | Argument | Description |
---|---|---|---|
command |
string | the command |
|
data |
* |
<optional> |
optional data to associate with the command |
Methods
-
<static> fromJsonEncoding(json [, dataParser])
-
Parse a JSON string into a
module:domain~SshCommand
instance.The JSON must be encoded the same way
module:domain~SshCommand#toJsonEncoding
does.Parameters:
Name Type Argument Description json
string the JSON to parse
dataParser
function <optional>
if provided, a function that accepts a string of JSON and returns an object representation of that data; if not provided then a simple object parsed via
JSON.parse()
will be usedReturns:
the command instance
- Type
- module:domain~SshCommand
-
toJsonEncoding()
-
Get this object as a standard JSON encoded string value.
If
data
has atoJsonEncoding()
function, that will be invoked and used in the result. Otherwise thedata
object will be serialized to JSON viaJSON.stringify()
.Returns:
the JSON encoded string
- Type
- string