outgoingMessage.write(chunk[, encoding][, callback])
chunk
<string> | <Buffer> | <Uint8Array>encoding
<string> 默认值:utf8
callback
<Function>- 返回 <boolean>
发送一块正文。 此方法可以被多次调用。
encoding
参数仅在 chunk
是字符串时才相关。
默认为 'utf8'
。
callback
参数是可选的,当此数据被刷新时将被调用。
如果整个数据被成功刷新到内核缓冲区,则返回 true
。
如果所有或部分数据在用户内存中排队,则返回 false
。
当缓冲区再次空闲时将触发 'drain'
事件。
chunk
<string> | <Buffer> | <Uint8Array>encoding
<string> Default:utf8
callback
<Function>- Returns <boolean>
Sends a chunk of the body. This method can be called multiple times.
The encoding
argument is only relevant when chunk
is a string. Defaults to
'utf8'
.
The callback
argument is optional and will be called when this chunk of data
is flushed.
Returns true
if the entire data was flushed successfully to the kernel
buffer. Returns false
if all or part of the data was queued in the user
memory. The 'drain'
event will be emitted when the buffer is free again.