util.isError()

util.isError(object) Stability: 0 - Deprecated Returns true if the given "object" is an Error. Otherwise, returns false. const util = require('util'); util.isError(new Error()) // true util.isError(new TypeError()) // true util.isError({ name: 'Error', message: 'an error occurred' }) // false Note that this method relies on Object.prototype.toString() behavior. It is possible to obtain an incorrect result when the object argument manipulates @@toStringTag. // This example requires the

vm.runInDebugContext()

vm.runInDebugContext(code) vm.runInDebugContext() compiles and executes code inside the V8 debug context. The primary use case is to get access to the V8 debug object: const Debug = vm.runInDebugContext('Debug'); Debug.scripts().forEach(function(script) { console.log(script.name); }); Note that the debug context and object are intrinsically tied to V8's debugger implementation and may change (or even get removed) without prior warning. The debug object can also be exposed with the --expose_de

request.end()

request.end([data][, encoding][, callback]) Finishes sending the request. If any parts of the body are unsent, it will flush them to the stream. If the request is chunked, this will send the terminating '0\r\n\r\n'. If data is specified, it is equivalent to calling response.write(data, encoding) followed by request.end(callback). If callback is specified, it will be called when the request stream is finished.

buffer.writeInt16LE()

buf.writeInt16LE(value, offset[, noAssert]) value <Number> Bytes to be written to Buffer offset <Number> 0 <= offset <= buf.length - 2 noAssert <Boolean> Default: false Return: <Number> The offset plus the number of written bytes Writes value to the Buffer at the specified offset with specified endian format (writeInt16BE() writes big endian, writeInt16LE() writes little endian). The value should be a valid signed 16-bit integer. Behavior is not defined when

Sign

Class: Sign The Sign Class is a utility for generating signatures. It can be used in one of two ways: As a writable stream, where data to be signed is written and the sign.sign() method is used to generate and return the signature, or Using the sign.update() and sign.sign() methods to produce the signature. The crypto.createSign() method is used to create Sign instances. Sign objects are not to be created directly using the new keyword. Example: Using Sign objects as streams: const crypto

buffer.writeUInt32LE()

buf.writeUInt32LE(value, offset[, noAssert]) value <Number> Bytes to be written to Buffer offset <Number> 0 <= offset <= buf.length - 4 noAssert <Boolean> Default: false Return: <Number> The offset plus the number of written bytes Writes value to the Buffer at the specified offset with specified endian format (writeUInt32BE() writes big endian, writeUInt32LE() writes little endian). The value should be a valid unsigned 32-bit integer. Behavior is not defined

Buffer

Class: Buffer The Buffer class is a global type for dealing with binary data directly. It can be constructed in a variety of ways.

exit event (Worker)

Event: 'exit' code <Number> the exit code, if it exited normally. signal <String> the name of the signal (eg. 'SIGHUP') that caused the process to be killed. Similar to the cluster.on('exit') event, but specific to this worker. const worker = cluster.fork(); worker.on('exit', (code, signal) => { if( signal ) { console.log(`worker was killed by signal: ${signal}`); } else if( code !== 0 ) { console.log(`worker exited with error code: ${code}`); } else { cons

http_server.listen()

server.listen(handle[, callback]) handle <Object> callback <Function> The handle object can be set to either a server or socket (anything with an underlying _handle member), or a {fd: <n>} object. This will cause the server to accept connections on the specified handle, but it is presumed that the file descriptor or handle has already been bound to a port or domain socket. Listening on a file descriptor is not supported on Windows. This function is asynchronous. The l

buffer.readUInt16LE()

buf.readUInt16LE(offset[, noAssert]) offset <Number> 0 <= offset <= buf.length - 2 noAssert <Boolean> Default: false Return: <Number> Reads an unsigned 16-bit integer from the Buffer at the specified offset with specified endian format (readInt32BE() returns big endian, readInt32LE() returns little endian). Setting noAssert to true skips validation of the offset. This allows the offset to be beyond the end of the Buffer. Example: const buf = Buffer.from([0x3, 0x