title: Node JS chunk files reading as one file without interrupt?
body: <p>I successfully read m3u8 and extract ts files and read m3u8 and check if new indexes are written to it (ts files) and then using</p>
  
  <pre><code>res.write(chunk);
  </code></pre>
  
  <p>i get stream without interrupting..it is reading files in order that was defined in m3u8 file and all is working flawlessly...but i have one HUGE problem...using res.write i im getting that my chunk ts files are read from HDD to RAM and RAM usage is incresed every seconds by 1MB so in about one hour i will get into out of memory...so the question is how can i erase previus read ts files from RAM so that memory usage will remain all the time same?</p>
  
  <p>I see that res.write is writing to memory but is not deleting old data from memory..and this way is not practical and will get out of memory errors.Can i use for res.write buffers size so when buffer size is full automatically get erased from memory and read next chunk data to RAM?</p>
  
  <p>Here is the code:</p>
  
  <pre><code>fs.readFile('/tmp/files/'+ts[ts.length-2], function (err, data ) {
      res.write(data);
      /* HERE I NEED TO CLEAR DATA BUFFER CHUNK FROM MEMORY */
  });
  </code></pre>
  
  <p>So i read 1000 files in loop (small chunks) and write it to response to client...this works excellent without interrupting...but memory usage is file size read on HDD so RAM usage is growing...how can i delete data from memory after they is send to client?</p>