API-Version: 1.9

io

Static object for input and output

Source:

Methods

<static> confirm(prompt) → {Boolean}

Shows a confirmation prompt

Parameters:
Name Type Description
prompt String

The prompt message

Source:
Returns:

True if y was pressed, false if n or escape was pressed

Type
Boolean

<static> debug(detail) → {void}

Prints a debug messsage and the callstack to stderr

Parameters:
Name Type Description
detail Object

Message details

Properties
Name Type Description
message String

A message

error Error

A javascript Error object

arguments Error

Arguments, only useful for the internal api

Source:
Returns:
Type
void

<static> dirnames(path) → {Array[String]}

Get directory entries

Parameters:
Name Type Description
path String

A path to a directory

Source:
Returns:

An array of file names

Type
Array[String]

<static> error(message)

Show an error message in the browser window

Parameters:
Name Type Description
message String

The error message

Source:

<static> notify(message)

Show a notification in the browser window

Parameters:
Name Type Description
message String

The message

Source:

<static> print(text, stream)

Print messages to stdout or stderr

Parameters:
Name Type Argument Description
text String

The text to print

stream String <optional>

The stream, either "stdout" or "stderr", default "stdout"

Source:

<static> prompt(prompt, visible) → {String}

Gets user input synchronously

Parameters:
Name Type Argument Description
prompt String

The prompt message

visible Boolean <optional>

Whether the chars should be visible, pass false for a password prompt, default true.

Source:
Returns:

The user response

Type
String

<static> read(path) → {String}

Read from a file

Parameters:
Name Type Description
path String

A path to a file

Source:
Returns:

The file content

Type
String

<static> write(path, mode, text) → {Boolean}

Write to a file

Parameters:
Name Type Description
path String

Path to a file to write to

mode String

Either "a" to append or "w" to strip the file

text String

The text that should be written to the file

Source:
Returns:

true if writing was successful

Type
Boolean