Piping Stream output to Socket.IO in NodeJS

I open curl to download some ISO at the background and inform the client about the progress. Since curl, wget and many others clear output. I want the output of curl to be seen at browser. I cannot exactly pipe it because the browser will not understand, It is basically changing the output data via ncurses or something I dont know. How can I solve this?

var spawn = require('child_process').spawn,
    curl    = spawn('curl', ['-oubuntu.iso','http://releases.ubuntu.com/10.04/ubuntu-10.04.4-desktop-i386.iso']);

curl.stderr.pipe(process.stdout); // Works perfectly:

  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  1  694M    1 13.5M    0     0  2193k      0  0:05:24  0:00:06  0:05:18 2439k

But process.on("data") is not consistent, random number changes new lines etc..

Well, process.stderr.on('data') is actually producing the correct data, so saying it is not consistent is wrong.

It seems that curl is just updating the changed parts of the progress state using the process' stderr stream, thats why you get different data every time the event is triggered.

I couldn't find a workaround for this (checking http://curl.haxx.se/docs/manpage.html), you obviously can't tell curl to report the progress in a "raw" way.

Hint: when using the curl flag -#, you get the percent progress each time the 'data' event is triggered.