Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
stream.on('data', data => {
buffer += data.toString()
while(buffer.indexOf('\n') > -1) {
let line = buffer.substring(0, buffer.indexOf('\n'))
buffer = buffer.substring(buffer.indexOf('\n') + 1)
lines.emit('line', line, ansi.ansi_to_text(line), ansi.ansi_to_html(line.replace('<', '<'), {use_classes: true}))
}
if(promptPattern && promptPattern.test(ansi.ansi_to_text(buffer))) {
lines.emit('prompt', buffer)
}
})
stream.on('data', data => {
buffer += data.toString()
while(buffer.indexOf('\n') > -1) {
let line = buffer.substring(0, buffer.indexOf('\n'))
buffer = buffer.substring(buffer.indexOf('\n') + 1)
lines.emit('line', line, ansi.ansi_to_text(line), ansi.ansi_to_html(line.replace('<', '<'), {use_classes: true}))
}
if(promptPattern && promptPattern.test(ansi.ansi_to_text(buffer))) {
lines.emit('prompt', buffer)
}
})