response.finished

response.finished Boolean value that indicates whether the response has completed. Starts as false. After response.end() executes, the value will be true.

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}`); });

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

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.setSocketKeepAlive()

request.setSocketKeepAlive([enable][, initialDelay]) Once a socket is assigned to this request and is connected socket.setKeepAlive() 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.setNoDelay()

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

request.flushHeaders()

request.flushHeaders() Flush the request headers. For efficiency reasons, Node.js normally buffers the request headers until you call request.end() or write the first chunk of request data. It then tries hard to pack the request headers and data into a single TCP packet. That's usually what you want (it saves a TCP round-trip) but not when the first data isn't sent until possibly much later. request.flushHeaders() lets you bypass the optimization and kickstart the request.

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.