tls.createSecureContext()

tls.createSecureContext(options) Creates a credentials object; the options object may contain the following fields: pfx : A string or Buffer holding the PFX or PKCS12 encoded private key, certificate, and CA certificates. key: A string or Buffer containing the private key of the server in PEM format. To support multiple keys using different algorithms, an array can be provided. It can either be a plain array of keys or an array of objects in the format {pem: key, passphrase: passphrase}. (Re

Buffer.byteLength()

Class Method: Buffer.byteLength(string[, encoding]) string <String> | <Buffer> | <TypedArray> | <DataView> | <ArrayBuffer> encoding <String> Default: 'utf8' Return: <Number> Returns the actual byte length of a string. This is not the same as String.prototype.length since that returns the number of characters in a string. Example: const str = '\u00bd + \u00bc = \u00be'; console.log(`${str}: ${str.length} characters, ` + `${Buffer.by

Interface

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

interface.close()

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

DiffieHellman

Class: DiffieHellman The DiffieHellman class is a utility for creating Diffie-Hellman key exchanges. Instances of the DiffieHellman class can be created using the crypto.createDiffieHellman() function. const crypto = require('crypto'); const assert = require('assert'); // Generate Alice's keys... const alice = crypto.createDiffieHellman(2048); const alice_key = alice.generateKeys(); // Generate Bob's keys... const bob = crypto.createDiffieHellman(alice.getPrime(), alice.getGenerator()); con

online event (Worker)

Event: 'online' Similar to the cluster.on('online') event, but specific to this worker. cluster.fork().on('online', () => { // Worker is online }); It is not emitted in the worker.

http.createServer()

http.createServer([requestListener]) Returns a new instance of http.Server. The requestListener is a function which is automatically added to the 'request' event.

resumeSession event (tls.Server)

Event: 'resumeSession' function (sessionId, callback) { } Emitted when the client wants to resume the previous TLS session. The event listener may perform a lookup in external storage using the given sessionId and invoke callback(null, sessionData) once finished. If the session can't be resumed (i.e., doesn't exist in storage) one may call callback(null, null). Calling callback(err) will terminate incoming connection and destroy the socket. NOTE: adding this event listener will only have an e

domain.intercept()

domain.intercept(callback) callback <Function> The callback function return: <Function> The intercepted function This method is almost identical to domain.bind(callback). However, in addition to catching thrown errors, it will also intercept Error objects sent as the first argument to the function. In this way, the common if (err) return callback(err); pattern can be replaced with a single error handler in a single place. Example const d = domain.create(); function readSomeFil

hash.update()

hash.update(data[, input_encoding]) Updates the hash content with the given data, the encoding of which is given in input_encoding and can be 'utf8', 'ascii' or 'binary'. If encoding is not provided, and the data is a string, an encoding of 'binary' is enforced. If data is a Buffer then input_encoding is ignored. This can be called many times with new data as it is streamed.