title: What's the most efficient way to read a very large file in chunks?
body: <p>I want to read a CSV file which can be at a size of hundreds of GBs and even TB.
  I got a limitation that I can only read the file in chunks of 32MB. 
  My solution to the problem works kinda slow and I wanted to ask if you know of a better solution:</p>
  
  <pre><code>const int MAX_BUFFER = 33554432; //32MB
  byte[] buffer = new byte[MAX_BUFFER];
  int bytesRead;
  
  using (FileStream fs = File.Open(filePath, FileMode.Open, FileAccess.Read))
  using (BufferedStream bs = new BufferedStream(fs))
  {
      string line;
      bool stop = false;
      while ((bytesRead = bs.Read(buffer, 0, MAX_BUFFER)) != 0) //reading only 32mb chunks at a time
      {
          var stream = new StreamReader(new MemoryStream(buffer));
          while ((line = stream.ReadLine()) != null)
          {
              //process line
          }
  
      }
  }
  </code></pre>
  
  <p>EDIT: I'm adding a restriction saying that I cannot read the file line by line.</p>