user4951
user4951

Reputation: 33090

How to best and most efficiently Split files into vb.net

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.

Upvotes: 0

Views: 616

Answers (1)

KV Prajapati
KV Prajapati

Reputation: 94645

You may use BinaryReader class and its method to read file in chunks.

Dim chunk() As Byte
chunk = br.ReadBytes(1024)

Upvotes: 1

Related Questions