listening event (dgram.Socket)

Event: 'listening' The 'listening' event is emitted whenever a socket begins listening for datagram messages. This occurs as soon as UDP sockets are created.

listening event (Cluster)

Event: 'listening' worker <cluster.Worker> address <Object> After calling listen() from a worker, when the 'listening' event is emitted on the server, a 'listening' event will also be emitted on cluster in the master. The event handler is executed with two arguments, the worker contains the worker object and the address object contains the following connection properties: address, port and addressType. This is very useful if the worker is listening on more than one address.

line event (Readline)

Event: 'line' function (line) {} Emitted whenever the input stream receives an end of line (\n, \r, or \r\n), usually received when the user hits enter, or return. This is a good hook to listen for user input. Example of listening for 'line': rl.on('line', (cmd) => { console.log(`You just typed: ${cmd}`); });

interface.write()

rl.write(data[, key]) Writes data to output stream, unless output is set to null or undefined when calling createInterface. key is an object literal to represent a key sequence; available if the terminal is a TTY. This will also resume the input stream if it has been paused. Example: rl.write('Delete me!'); // Simulate ctrl+u to delete the line written previously rl.write(null, {ctrl: true, name: 'u'});

interface.setPrompt()

rl.setPrompt(prompt) Sets the prompt, for example when you run node on the command line, you see > , which is Node.js's prompt.

interface.resume()

rl.resume() Resumes the readline input stream.

interface.question()

rl.question(query, callback) Prepends the prompt with query and invokes callback with the user's response. Displays the query to the user, and then invokes callback with the user's response after it has been typed. This will also resume the input stream used with createInterface if it has been paused. If output is set to null or undefined when calling createInterface, nothing is displayed. Example usage: rl.question('What is your favorite food?', (answer) => { console.log(`Oh, so your

interface.prompt()

rl.prompt([preserveCursor]) Readies readline for input from the user, putting the current setPrompt options on a new line, giving the user a new spot to write. Set preserveCursor to true to prevent the cursor placement being reset to 0. This will also resume the input stream used with createInterface if it has been paused. If output is set to null or undefined when calling createInterface, the prompt is not written.

interface.pause()

rl.pause() Pauses the readline input stream, allowing it to be resumed later if needed. Note that this doesn't immediately pause the stream of events. Several events may be emitted after calling pause, including line.

interface.close()

rl.close() Closes the Interface instance, relinquishing control on the input and output streams. The 'close' event will also be emitted.