How to best and most efficiently Split files into vb.net
-
13-11-2019 - |
Pergunta
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.
Solução
You may use BinaryReader class and its method to read file in chunks.
Dim chunk() As Byte
chunk = br.ReadBytes(1024)
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow