response.end()

response.end([data][, encoding][, callback]) This method signals to the server that all of the response headers and body have been sent; that server should consider this message complete. The method, response.end(), MUST be called on each response. If data is specified, it is equivalent to calling response.write(data, encoding) followed by response.end(callback). If callback is specified, it will be called when the response stream is finished.

request.write()

request.write(chunk[, encoding][, callback]) Sends a chunk of the body. By calling this method many times, the user can stream a request body to a server--in that case it is suggested to use the ['Transfer-Encoding', 'chunked'] header line when creating the request. The chunk argument should be a Buffer or a string. The encoding argument is optional and only applies when chunk is a string. Defaults to 'utf8'. The callback argument is optional and will be called when this chunk of data is flu

resize event (WriteStream)

Event: 'resize' function () {} Emitted by refreshSize() when either of the columns or rows properties has changed. process.stdout.on('resize', () => { console.log('screen size has changed!'); console.log(`${process.stdout.columns}x${process.stdout.rows}`); });

reset event (REPLServer)

Event: 'reset' function (context) {} Emitted when the REPL's context is reset. This happens when you type .clear. If you start the repl with { useGlobal: true } then this event will never be emitted. Example of listening for reset: // Extend the initial repl context. var replServer = repl.start({ options ... }); someExtension.extend(r.context); // When a new context is created extend it as well. replServer.on('reset', (context) => { console.log('repl has a new context'); someExtensio

response event (http.ClientRequest)

Event: 'response' function (response) { } Emitted when a response is received to this request. This event is emitted only once. The response argument will be an instance of http.IncomingMessage. Options: host: A domain name or IP address of the server to issue the request to. port: Port of remote server. socketPath: Unix Domain Socket (use one of host:port or socketPath)

request.setNoDelay()

request.setNoDelay([noDelay]) Once a socket is assigned to this request and is connected socket.setNoDelay() will be called.

request.setTimeout()

request.setTimeout(timeout[, callback]) Once a socket is assigned to this request and is connected socket.setTimeout() will be called. timeout {Number} Milliseconds before a request is considered to be timed out. callback {Function} Optional function to be called when a timeout occurs. Same as binding to the timeout event.

request.setSocketKeepAlive()

request.setSocketKeepAlive([enable][, initialDelay]) Once a socket is assigned to this request and is connected socket.setKeepAlive() will be called.

request event (http.Server)

Event: 'request' function (request, response) { } Emitted each time there is a request. Note that there may be multiple requests per connection (in the case of keep-alive connections). request is an instance of http.IncomingMessage and response is an instance of http.ServerResponse.

request.abort()

request.abort() Marks the request as aborting. Calling this will cause remaining data in the response to be dropped and the socket to be destroyed.