outgoingMessage.end(chunk[, encoding][, callback])
chunk
<string> | <Buffer>encoding
<string> 可选的,默认值:utf-8
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:utf-8
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 trailer (if any).
If chunk
is specified, it is equivalent to call
outgoingMessage.write(chunk, encoding)
, followed by
outgoingMessage.end(callback)
.
If callback
is provided, it will be called when the message is finished.
(equivalent to the callback to event finish
)