c# split large file into chunks
public static void SplitFile(string inputFile, int chunkSize, string path)
{
const int BUFFER_SIZE = 20 * 1024;
byte[] buffer = new byte[BUFFER_SIZE];
using (Stream input = File.OpenRead(inputFile))
{
int index = 0;
while (input.Position < input.Length)
{
using (Stream output = File.Create(path + "\\" + index))
{
int remaining = chunkSize, bytesRead;
while (remaining > 0 && (bytesRead = input.Read(buffer, 0,
Math.Min(remaining, BUFFER_SIZE))) > 0)
{
output.Write(buffer, 0, bytesRead);
remaining -= bytesRead;
}
}
index++;
Thread.Sleep(500); // experimental; perhaps try it
}
}
}
Also in C#:
- snake game
- what is the or symbol in C#
- C# resize window without title bar
- c# object clone
- unity onclick object
- web api startup add imemory cache object
- c# trim string
- console.writeline c#
- c# loop string array
- how to get component in unity c#
- how to reference the position of a game object unity
- linq in c#
- C# extend array
- C# get all child classes of a class
- iteration c#
- Movement 2d unity
- convert generic to type c#
- how to get length of okobjectresult c#
- c# static meaning
- using mediamanager how to play mp3 files
- asp.net core allow all origins
- unity how to change rotation
- condition when a animation finishes in unity
- c# console delay