filehandle.createWriteStream([options])
options<Object>- 返回:<fs.WriteStream>
options 也可以包含一个 start 选项,以允许在文件开头之后的某个位置写入数据,允许的值在 [0, Number.MAX_SAFE_INTEGER] 范围内。修改文件而不是替换文件可能需要将 flags open 选项设置为 r+,而不是默认的 r。encoding 可以是 <Buffer> 接受的任何一种编码。
如果在 'error' 或 'finish' 上将 autoClose 设置为 true(默认行为),文件描述符将会自动关闭。如果 autoClose 为 false,即使发生错误,文件描述符也不会关闭。由应用负责关闭它,并确保不会发生文件描述符泄漏。
【If autoClose is set to true (default behavior) on 'error' or 'finish'
the file descriptor will be closed automatically. If autoClose is false,
then the file descriptor won't be closed, even if there's an error.
It is the application's responsibility to close it and make sure there's no
file descriptor leak.】
默认情况下,流在被销毁后会触发 'close' 事件。将 emitClose 选项设置为 false 可以更改此行为。
【By default, the stream will emit a 'close' event after it has been
destroyed. Set the emitClose option to false to change this behavior.】