title: How to determine HTTP range request start & end bytes (nodejs + mongodb)
body: <p>I wonder if it is possible to determine the start &amp; end bytes in HTTP range requests or let the browser somehow know where to start and let it use some user defined chunk size or so.
  I have a file in my database and it is split into multiple chunks, each chunk is 2 MB. </p>
  
  <p>eg. 20 MB file => 10 chunks</p>
  
  <p>When the browser starts downloading the file (video file), I have studied Chrome, it firsts checks the <code>'range=bytes 0-'</code> byte range and if the server sucessfully responds with the 'right' bytes and 206 headers back, then it sends another request for the end bytes of the file eg <code>'range=bytes 1900000-'</code>, </p>
  
  <p>It just checkes if your server responds well for the partial response</p>
  
  <p>On the serverside I have coded my app so that it will send 2 MB partials if you ask it nicely to it :)</p>
  
  <p>What I want the browser to do</p>
  
  <p><code>range=bytes 0-'</code></p>
  
  <p><code>range=bytes 2000000-4000000 bytes'</code></p>
  
  <p><code>range=bytes 4000000-6000000 bytes'</code></p>
  
  <p>But if you ask a partial which doesnt fit in a 2mb chunk it will give an error. Or it will just not play from the right position for a audio/video file.</p>
  
  <p><code>range=bytes 2500000-4000000 bytes'</code> </p>
  
  <p><code>range=bytes 0-1000000 bytes'</code> </p>
  
  <p>this will give an error because I cannot start to send from a part of a chunk. Otherwise I have to slice my chunks and do some buffer operations. But I want to keep it clean.
  If this is possible please let me know.</p>