outgoingMessage.end(chunk[, encoding][, callback])
chunk
<string> | <Buffer>encoding
<string> 可选的,默认值:utf8
callback
<Function> 可选的- 返回: <this>
完成传出消息。
如果正文的任何部分未发送,则会将它们刷新到底层系统。
如果消息被分块,则它将发送终止块 0\r\n\r\n
,并发送块尾(如果有)。
如果指定了 chunk
,则相当于调用 outgoingMessage.write(chunk, encoding)
,后跟 outgoingMessage.end(callback)
。
如果提供了 callback
,则在消息结束时调用(相当于 'finish'
事件的监听器)。
chunk
<string> | <Buffer>encoding
<string> Optional, Default:utf8
callback
<Function> Optional- Returns: <this>
Finishes the outgoing message. If any parts of the body are unsent, it will
flush them to the underlying system. If the message is chunked, it will
send the terminating chunk 0\r\n\r\n
, and send the trailers (if any).
If chunk
is specified, it is equivalent to calling
outgoingMessage.write(chunk, encoding)
, followed by
outgoingMessage.end(callback)
.
If callback
is provided, it will be called when the message is finished
(equivalent to a listener of the 'finish'
event).