Functions
Rand(n) ⇒ Uint8Array
Rand returns a random byte slice of length n
Kind: global functionReturns:
Uint8Array - - The random byte slice.
| Param | Type | Description | 
|---|---|---|
| n | number | The length of the byte slice. | 
RandInt() ⇒ number
RandInt returns a random int
Kind: global functionReturns:
number - - The random integer.Example
log(msg)
log prints given input to stdout with [JS] prefix for debugging purposes Kind: global function| Param | Type | Description | 
|---|---|---|
| msg | string | Object | The message to print. | 
getNetworkPort(port, defaultPort) ⇒ string
getNetworkPort registers defaultPort and returns defaultPort if it is a colliding port with other protocols
Kind: global functionReturns:
string - - The default port if the given port is colliding, otherwise the given port.
| Param | Type | Description | 
|---|---|---|
| port | string | The port to check. | 
| defaultPort | string | The default port to return if the given port is colliding. | 
isPortOpen(host, port, [timeout]) ⇒ boolean
isPortOpen checks if given port is open on host. timeout is optional and defaults to 5 seconds
Kind: global functionReturns:
boolean - - True if the port is open, false otherwise.
| Param | Type | Default | Description | 
|---|---|---|---|
| host | string | The host to check. | |
| port | string | The port to check. | |
| [timeout] | number | 5 | The timeout in seconds. | 
ToBytes(…args) ⇒ Uint8Array
ToBytes converts given input to byte slice
Kind: global functionReturns:
Uint8Array - - The byte slice.
| Param | Type | Description | 
|---|---|---|
| …args | any | The input to convert. | 
ToString(…args) ⇒ string
ToString converts given input to string
Kind: global functionReturns:
string - - The string.
| Param | Type | Description | 
|---|---|---|
| …args | any | The input to convert. |