rejectionHandled event (Process)

Event: 'rejectionHandled' Emitted whenever a Promise was rejected and an error handler was attached to it (for example with .catch()) later than after an event loop turn. This event is emitted with the following arguments: p the promise that was previously emitted in an 'unhandledRejection' event, but which has now gained a rejection handler. There is no notion of a top level for a promise chain at which rejections can always be handled. Being inherently asynchronous in nature, a promise re

url.parse()

url.parse(urlStr[, parseQueryString][, slashesDenoteHost]) Take a URL string, and return an object. Pass true as the second argument to also parse the query string using the querystring module. If true then the query property will always be assigned an object, and the search property will always be a (possibly empty) string. If false then the query property will not be parsed or decoded. Defaults to false. Pass true as the third argument to treat //foo/bar as { host: 'foo', pathname: '/bar' }

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

path.relative()

path.relative(from, to) Solve the relative path from from to to. At times we have two absolute paths, and we need to derive the relative path from one to the other. This is actually the reverse transform of path.resolve, which means we see that: path.resolve(from, path.relative(from, to)) == path.resolve(to) Examples: path.relative('C:\\orandea\\test\\aaa', 'C:\\orandea\\impl\\bbb') // returns '..\\..\\impl\\bbb' path.relative('/data/orandea/test/aaa', '/data/orandea/impl/bbb') // returns '

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

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

cipher.setAutoPadding()

cipher.setAutoPadding(auto_padding=true) When using block encryption algorithms, the Cipher class will automatically add padding to the input data to the appropriate block size. To disable the default padding call cipher.setAutoPadding(false). When auto_padding is false, the length of the entire input data must be a multiple of the cipher's block size or cipher.final() will throw an Error. Disabling automatic padding is useful for non-standard padding, for instance using 0x0 instead of PKCS pa

ReadStream

Class: ReadStream A net.Socket subclass that represents the readable portion of a tty. In normal circumstances, process.stdin will be the only tty.ReadStream instance in any Node.js program (only when isatty(0) is true).

tlsSocket.encrypted

tlsSocket.encrypted Static boolean value, always true. May be used to distinguish TLS sockets from regular ones.

os.cpus()

os.cpus() Returns an array of objects containing information about each CPU/core installed: model, speed (in MHz), and times (an object containing the number of milliseconds the CPU/core spent in: user, nice, sys, idle, and irq). Example inspection of os.cpus: [ { model: 'Intel(R) Core(TM) i7 CPU 860 @ 2.80GHz', speed: 2926, times: { user: 252020, nice: 0, sys: 30340, idle: 1070356870, irq: 0 } }, { model: 'Intel(R) Core(TM) i7 CPU 8