script.runInThisContext()

script.runInThisContext([options]) Similar to vm.runInThisContext() but a method of a precompiled Script object. script.runInThisContext() runs script's compiled code and returns the result. Running code does not have access to local scope, but does have access to the current global object. Example of using script.runInThisContext() to compile code once and run it multiple times: const vm = require('vm'); global.globalVar = 0; const script = new vm.Script('globalVar += 1', { filename: 'myfi

secureConnect event (tls.TLSSocket)

Event: 'secureConnect' This event is emitted after the handshaking process for a new connection has successfully completed. The listener will be called regardless of whether or not the server's certificate has been authorized. It is the user's responsibility to test tlsSocket.authorized to see if the server certificate was signed by one of the specified CAs. If tlsSocket.authorized === false then the error can be found in tlsSocket.authorizationError. Also, if either ALPN or NPN was used tlsSoc

script.runInNewContext()

script.runInNewContext([sandbox][, options]) Similar to vm.runInNewContext() but a method of a precompiled Script object. script.runInNewContext() contextifies sandbox if passed or creates a new contextified sandbox if it's omitted, and then runs script's compiled code with the sandbox as the global object and returns the result. Running code does not have access to local scope. script.runInNewContext() takes the same options as script.runInThisContext(). Example: compile code that sets a glo

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

Script

Class: Script A class for holding precompiled scripts, and running them in specific sandboxes.

script.runInContext()

script.runInContext(contextifiedSandbox[, options]) Similar to vm.runInContext() but a method of a precompiled Script object. script.runInContext() runs script's compiled code in contextifiedSandbox and returns the result. Running code does not have access to local scope. script.runInContext() takes the same options as script.runInThisContext(). Example: compile code that increments a global variable and sets one, then execute the code multiple times. These globals are contained in the sandbo

response.writeHead()

response.writeHead(statusCode[, statusMessage][, headers]) Sends a response header to the request. The status code is a 3-digit HTTP status code, like 404. The last argument, headers, are the response headers. Optionally one can give a human-readable statusMessage as the second argument. Example: var body = 'hello world'; response.writeHead(200, { 'Content-Length': body.length, 'Content-Type': 'text/plain' }); This method must only be called once on a message and it must be called before

resume event (Readline)

Event: 'resume' function () {} Emitted whenever the input stream is resumed. Example of listening for 'resume': rl.on('resume', () => { console.log('Readline resumed.'); });

response.writeContinue()

response.writeContinue() Sends a HTTP/1.1 100 Continue message to the client, indicating that the request body should be sent. See the 'checkContinue' event on Server.

response.write()

response.write(chunk[, encoding][, callback]) If this method is called and response.writeHead() has not been called, it will switch to implicit header mode and flush the implicit headers. This sends a chunk of the response body. This method may be called multiple times to provide successive parts of the body. chunk can be a string or a buffer. If chunk is a string, the second parameter specifies how to encode it into a byte stream. By default the encoding is 'utf8'. The last parameter callbac