cluster.schedulingPolicy

cluster.schedulingPolicy The scheduling policy, either cluster.SCHED_RR for round-robin or cluster.SCHED_NONE to leave it to the operating system. This is a global setting and effectively frozen once you spawn the first worker or call cluster.setupMaster(), whatever comes first. SCHED_RR is the default on all operating systems except Windows. Windows will change to SCHED_RR once libuv is able to effectively distribute IOCP handles without incurring a large performance hit. cluster.schedulingP

buffer.swap16()

buf.swap16() Return: <Buffer> Interprets the Buffer as an array of unsigned 16-bit integers and swaps the byte-order in-place. Throws a RangeError if the Buffer length is not a multiple of 16 bits. The method returns a reference to the Buffer, so calls can be chained. const buf = Buffer.from([0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8]); console.log(buf); // Prints Buffer(0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8) buf.swap16(); console.log(buf); // Prints Buffer(0x2, 0x1, 0x4, 0x3, 0x6,

certificate.exportChallenge()

certificate.exportChallenge(spkac) The spkac data structure includes a public key and a challenge. The certificate.exportChallenge() returns the challenge component in the form of a Node.js Buffer. The spkac argument can be either a string or a Buffer. const cert = require('crypto').Certificate(); const spkac = getSpkacSomehow(); const challenge = cert.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints the challenge as a UTF8 string

buffer.writeIntLE()

buf.writeIntLE(value, offset, byteLength[, noAssert]) value <Number> Bytes to be written to Buffer offset <Number> 0 <= offset <= buf.length - byteLength byteLength <Number> 0 < byteLength <= 6 noAssert <Boolean> Default: false Return: <Number> The offset plus the number of written bytes Writes value to the Buffer at the specified offset and byteLength. Supports up to 48 bits of accuracy. For example: const buf1 = Buffer.allocUnsafe(6); buf1.wr

Certificate

Class: Certificate SPKAC is a Certificate Signing Request mechanism originally implemented by Netscape and now specified formally as part of HTML5's keygen element. The crypto module provides the Certificate class for working with SPKAC data. The most common usage is handling output generated by the HTML5 <keygen> element. Node.js uses OpenSSL's SPKAC implementation internally.

worker.suicide

worker.suicide <Boolean> Set by calling .kill() or .disconnect(), until then it is undefined. The boolean worker.suicide lets you distinguish between voluntary and accidental exit, the master may choose not to respawn a worker based on this value. cluster.on('exit', (worker, code, signal) => { if (worker.suicide === true) { console.log('Oh, it was just suicide\' – no need to worry'). } }); // kill worker worker.kill();

crypto.createCipher()

crypto.createCipher(algorithm, password) Creates and returns a Cipher object that uses the given algorithm and password. The algorithm is dependent on OpenSSL, examples are 'aes192', etc. On recent OpenSSL releases, openssl list-cipher-algorithms will display the available cipher algorithms. The password is used to derive the cipher key and initialization vector (IV). The value must be either a 'binary' encoded string or a Buffer. The implementation of crypto.createCipher() derives keys usin

message.headers

message.headers The request/response headers object. Key-value pairs of header names and values. Header names are lower-cased. Example: // Prints something like: // // { 'user-agent': 'curl/7.22.0', // host: '127.0.0.1:8000', // accept: '*/*' } console.log(request.headers); Duplicates in raw headers are handled in the following ways, depending on the header name: Duplicates of age, authorization, content-length, content-type, etag, expires, from, host, if-modified-since, if-unmodified-si

http.ClientRequest

Class: http.ClientRequest This object is created internally and returned from http.request(). It represents an in-progress request whose header has already been queued. The header is still mutable using the setHeader(name, value), getHeader(name), removeHeader(name) API. The actual header will be sent along with the first data chunk or when closing the connection. To get the response, add a listener for 'response' to the request object. 'response' will be emitted from the request object when t

error event (dgram.Socket)

Event: 'error' exception <Error> The 'error' event is emitted whenever any error occurs. The event handler function is passed a single Error object.