nodejs / help

:sparkles: Need help with Node.js? File an Issue here. :rocket:
1.48k stars 284 forks source link

More efficient line parser for streams #1563

Closed ORESoftware closed 5 years ago

ORESoftware commented 6 years ago

I have imported:

const readline = require('readline');

I have this method:

  combine(readable: Readable) {

    readline.createInterface({
      input: readable
    })
      .on('line', l => {
        this.trans.write(l + '\n');
      });
  }

this should ensure that I get a whole line of output from the readable stream input. My question is, is there a better way or simpler way to do this, instead of using readline.createInterface()?

gireeshpunathil commented 6 years ago

hi @ORESoftware - in core I don't think we have a better interface than this, I am aware of npm modules that do this as their main exported feature, for example: https://www.npmjs.com/package/linestream https://www.npmjs.com/search?q=linereader

gireeshpunathil commented 5 years ago

ping @ORESoftware

ORESoftware commented 5 years ago

hey thanks, yeah np I can work with this

gireeshpunathil commented 5 years ago

closing then, thanks!