Node Pipeline Stream Sending Incomplete Data?

  node.js, question

Project address

function loadFile(file,rela,raw,res){
 if(!  raw){
 Varfilename = rela.substring (rela.lastindex of ('/') plus 1);
 if(filename.match(/\.(avi|mp4|mkv|rmvb|mpg|rm|wma)$/i)){
 res.render('video',{
 title:filename,
 Src:filename plus'?  raw=true'
 })
 }else if(filename.match(/\.(jpg|png|bmp|jepg|gif)$/i)){
 res.render('img',{
 title:filename,
 Src:filename plus'?  raw=true'
 })
 }else if(filename.match(/\.(mp3|wma|aac)$/i)){
 res.render('audio',{
 title:filename,
 Src:filename plus'?  raw=true'
 })
 }else {
 fs.createReadStream(file).pipe(res);
 bracket
 }else{
 //Pipeline Streaming Data
 fs.createReadStream(file).pipe(res);
 bracket
 bracket

But why when listening to music online, there is no data in half?Music

The same is true for the later change to this way.

var stream = fs.createReadStream(file);
 stream.on('data',function(d){
 res.write(d);
 });
 stream.on('end',function(){
 res.end();
 });  //.pipe(res);

In this last way, there is no sound

var stream = fs.createReadStream(file);
 stream.on('data',function(d){
 if(!  res.write(d))
 stream.pause();
 });
 stream.on('drain',function(){
 stream.resume();
 })
 stream.on('end',function(){
 res.end();
 });  //.pipe(res);

Set up the pipeline before spraying data.headerTry:

//Pipeline Streaming Data
 res.set({'Content-Type': 'audio/mp3'});
 fs.createReadStream(file).pipe(res);