code: function findSplit (str) {
    let r = str.indexOf('\r')
    let n = str.indexOf('\n')
    if (r === -1 && n === -1) return -1
    if (r === -1) return n + 1 // \n
    if (n === -1) return r + 1 // \r
    if (n === r + 1) return n + 1 // \r\n
    return Math.min(r, n) + 1 // \r or \n
  }
docs: Note: progress messages are designed to be written directly to the terminal, so they are often sent with just a carriage return to overwrite the last line of output. But there are also messages delimited with newlines. I also include CRLF just in case.