How to use the ansi_up.ansi_to_text function in ansi_up

To help you get started, we’ve selected a few ansi_up examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github criteo / loop / lib / utils.js View on Github external
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)
    }
  })
github criteo / loop / lib / utils.js View on Github external
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)
    }
  })

ansi_up

Convert ansi sequences in strings to colorful HTML

MIT
Latest version published 9 months ago

Package Health Score

64 / 100
Full package analysis