How to best and most efficiently Split files into vb.net
-
13-11-2019 - |
Question
Say I have a 5 GB file. I want to split it in the following way.
First 100 MB is on the file
The rest go some reserve file
I do not want to use readalllines kind of function because it's too slow for large files.
I do not want to read the whole file to the memory. I want the program to handle only a medium chunk of data at a time.
Solution
You may use BinaryReader class and its method to read file in chunks.
Dim chunk() As Byte
chunk = br.ReadBytes(1024)
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow