kevva / screenshot-stream

Capture screenshot of a website and return it as a stream
MIT License
236 stars 38 forks source link

shoul ensure phantomsj stderr is processed by line #22

Closed maboiteaspam closed 8 years ago

maboiteaspam commented 8 years ago

Hi,

In here https://github.com/kevva/screenshot-stream/blob/master/index.js#L63

You should ensure the stream is processed by lines, otherwise all the regex can break.

I faced a behavior where data event received chunks composed of multiple lines at once. It happened when i started to send quiet some data. With small amount of exchanged data, I have not noticed that behavior.

fore reference, I did that

var byline = require('byline');
byline(cp.stderr).on('data', function (data) {
    data = data.trim();
...

I rely on https://github.com/jahewson/node-byline

sindresorhus commented 8 years ago

:+1: PR welcome :)

maboiteaspam commented 8 years ago

my pleasure ! will leave you something before EOYear.