We have one zip file which may contains multiple PDFs/JPG/TIFF files.
We have a logic by which we are moving this large zip file from one folder to another folder (may be on some other server).
In this process, we are breaking the zip into chunks of 1 MB and then moving those chunks one by one.
Due to some unknown reason, sometimes, one or more chunks gets corrupted in this process and few files are getting corrupted.
When unzip
(programmatically or manually), we get errors like 'Headers Error'.
Here is the code we are using for moving the zip file:
while (inputZip.Length > nAmountWritten)
{
buffer = reader.ReadBytes(10 * 1024 * 1024);
bw.Write(buffer); //Binary Writer for destination
nAmountWritten += buffer.Length;
}
What approach can I take to avoid corrupted chunk writing on destination?