title: C# Append byte array to beginning of a file (without loading entire file in memory)
body: <p>Question: Is it possible (and how?) to append a byte array to an existing file without loading the entire file in memory.</p>
  
  <p>To be more specific:
  the goal is to do transform this:</p>
  
  <pre><code>00000000 89 50 4E 47 0D 0A 1A 0A 00 00 00 0D 49 48 44 52
  00000010 00 00 10 00 00 00 08 00 08 02 00 00 00 29 F0 61
  00000020 E9 00 00 00 09 70 48 59 73 00 00 17 12 00 00 17
  00000030 12 01 67 9F D2 52 00 00 20 00 49 44 41 54 78 DA
  00000040 DC BD DB 76 24 39 AE 2C 08 F0 E2 1E AA EA F9 FF
  00000050 FF 9C 5E A7 53 EE BC 60 1E 8C 80 C3 AF 0A 29 B3
  00000060 76 EF 33 7A A8 A5 52 46 F8 85 04 41 10 30 33 30
  00000070 33 D3 37 7F 44 E4 07 DF FA 5F F5 C3 CC 22 F2 F0
  00000080 AF 97 6F 8A AF E0 BB 0F 57 B0 7F 12 22 3E FD FD
  </code></pre>
  
  <p>into this:</p>
  
  <pre><code>--added bytes
  00000000 74 65 73 74 74 65 73 74 74 65 73 74 74 65 73 74
  --added bytes
  00000010 89 50 4E 47 0D 0A 1A 0A 00 00 00 0D 49 48 44 52
  00000020 00 00 10 00 00 00 08 00 08 02 00 00 00 29 F0 61
  00000030 E9 00 00 00 09 70 48 59 73 00 00 17 12 00 00 17
  00000040 12 01 67 9F D2 52 00 00 20 00 49 44 41 54 78 DA
  00000050 DC BD DB 76 24 39 AE 2C 08 F0 E2 1E AA EA F9 FF
  00000060 FF 9C 5E A7 53 EE BC 60 1E 8C 80 C3 AF 0A 29 B3
  00000070 76 EF 33 7A A8 A5 52 46 F8 85 04 41 10 30 33 30
  00000080 33 D3 37 7F 44 E4 07 DF FA 5F F5 C3 CC 22 F2 F0
  </code></pre>
  
  <p>I've been trying to figure this out the whole morning, but I can't seem to find a working solution.
  I know it is possible to append a file at the end without loading the file into memory, but I need to append the beginning.</p>
  
  <p>Thanks in advance</p>