process.umask()

process.umask([mask]) Sets or reads the process's file mode creation mask. Child processes inherit the mask from the parent process. Returns the old mask if mask argument is given, otherwise returns the current mask. const newmask = 0o022; const oldmask = process.umask(newmask); console.log( `Changed umask from ${oldmask.toString(8)} to ${newmask.toString(8)}` );

uncaughtException event (Process)

Event: 'uncaughtException' The 'uncaughtException' event is emitted when an exception bubbles all the way back to the event loop. By default, Node.js handles such exceptions by printing the stack trace to stderr and exiting. Adding a handler for the 'uncaughtException' event overrides this default behavior. For example: process.on('uncaughtException', (err) => { console.log(`Caught exception: ${err}`); }); setTimeout(() => { console.log('This will still run.'); }, 500); // Intenti

net_server.address()

server.address() Returns the bound address, the address family name and port of the server as reported by the operating system. Useful to find which port was assigned when giving getting an OS-assigned address. Returns an object with three properties, e.g. { port: 12346, family: 'IPv4', address: '127.0.0.1' } Example: var server = net.createServer((socket) => { socket.end('goodbye\n'); }).on('error', (err) => { // handle errors here throw err; }); // grab a random port. server.li

util.format()

util.format(format[, ...]) Returns a formatted string using the first argument as a printf-like format. The first argument is a string that contains zero or more placeholders. Each placeholder is replaced with the converted value from its corresponding argument. Supported placeholders are: %s - String. %d - Number (both integer and float). %j - JSON. Replaced with the string '[Circular]' if the argument contains circular references. %% - single percent sign ('%'). This does not consume an

stream.Readable

Class: stream.Readable stream.Readable is an abstract class designed to be extended with an underlying implementation of the stream._read(size) method. Please see API for Stream Consumers for how to consume streams in your programs. What follows is an explanation of how to implement Readable streams in your programs. new stream.Readable([options]) options <Object> highWaterMark <Number> The maximum number of bytes to store in the internal buffer before ceasing to read from the u

process.send()

process.send(message[, sendHandle[, options]][, callback]) message <Object> sendHandle <Handle object> options <Object> callback <Function> Return: <Boolean> When Node.js is spawned with an IPC channel attached, it can send messages to its parent process using process.send(). Each will be received as a 'message' event on the parent's ChildProcess object. Note: this function uses JSON.stringify() internally to serialize the message. If Node.js was not s

error.code

Applications running in Node.js will generally experience four categories of errors: Standard JavaScript errors such as: EvalError: thrown when a call to eval() fails. SyntaxError: thrown in response to improper JavaScript language syntax. RangeError: thrown when a value is not within an expected range ReferenceError: thrown when using undefined variables TypeError: thrown when passing arguments of the wrong type URIError: thrown when a global URI handling function is misused. System err

exit event (ChildProcess)

Event: 'exit' code <Number> the exit code if the child exited on its own. signal <String> the signal by which the child process was terminated. The 'exit' event is emitted after the child process ends. If the process exited, code is the final exit code of the process, otherwise null. If the process terminated due to receipt of a signal, signal is the string name of the signal, otherwise null. One of the two will always be non-null. Note that when the 'exit' event is triggered,

childprocess.stdin

child.stdin <Stream> A Writable Stream that represents the child process's stdin. Note that if a child process waits to read all of its input, the child will not continue until this stream has been closed via end(). If the child was spawned with stdio[0] set to anything other than 'pipe', then this will be undefined. child.stdin is an alias for child.stdio[0]. Both properties will refer to the same value.

Interface

Class: Interface The class that represents a readline interface with an input and output stream.