Skip to main content

Functions

Rand(n) ⇒ Uint8Array

Rand returns a random byte slice of length n Kind: global function
Returns: Uint8Array - - The random byte slice.
Example

RandInt() ⇒ number

RandInt returns a random int Kind: global function
Returns: number - - The random integer.
Example

log(msg)

log prints given input to stdout with [JS] prefix for debugging purposes Kind: global function Example

getNetworkPort(port, defaultPort) ⇒ string

getNetworkPort registers defaultPort and returns defaultPort if it is a colliding port with other protocols Kind: global function
Returns: string - - The default port if the given port is colliding, otherwise the given port.
Example

isPortOpen(host, port, [timeout]) ⇒ boolean

isPortOpen checks if given port is open on host. timeout is optional and defaults to 5 seconds Kind: global function
Returns: boolean - - True if the port is open, false otherwise.
Example

ToBytes(…args) ⇒ Uint8Array

ToBytes converts given input to byte slice Kind: global function
Returns: Uint8Array - - The byte slice.
Example

ToString(…args) ⇒ string

ToString converts given input to string Kind: global function
Returns: string - - The string.
Example