Joined October 2014
·

Claudio Marrero

Unvil
·
Mendoza
·
·
·

Posted to Read large text files in nodejs over 1 year ago

I'm trying to build a Straming for big audio files and serve to the browser,

I'm try with this part of code:

res.setHeader("content-type", "audio/mpeg");
var stream = fs.createReadStream('record.mp3', { bufferSize: 64 * 1024 });
stream.pipe(res);

But the problem with this is that when I put the URL into the audio tag (for example).

audio>
source src="http://127.0.0.1:8080/record.mp3" />
/audio>

Node.js read the entire file and send the complete file to the browser.

I'm working with audio files that they size is biggest that 500 mb.

Thanks.

Achievements
1 Karma
0 Total ProTip Views