writeStream.clearLine(dir[, callback])

  • dir <number>
    • -1: 从光标向左。
    • 1: 从光标向右。
    • 0: 整行。
  • callback <Function> 当操作完成时调用。
  • 返回: <boolean> 如果流期望调用的代码在继续写入其他数据之前等待 'drain' 事件触发,则为 false,否则为 true

writeStream.clearLine() 会以 dir 指定的方向清理此 WriteStream 的当前行。

  • dir <number>
    • -1: to the left from cursor
    • 1: to the right from cursor
    • 0: the entire line
  • callback <Function> Invoked once the operation completes.
  • Returns: <boolean> false if the stream wishes for the calling code to wait for the 'drain' event to be emitted before continuing to write additional data; otherwise true.

writeStream.clearLine() clears the current line of this WriteStream in a direction identified by dir.