Large folder (> 3Gib) throws exception "Stream was too long" #630

Open
opened 2026-01-29 22:14:57 +00:00 by claunia · 0 comments
Owner

Originally created by @xhuan8 on GitHub (Apr 23, 2024).

Hi, is it possible to turn on "x64" for large folder or this feature is not ready?

using (var archive = ZipArchive.Create())
{
    archive.AddAllFromDirectory(path);
    archive.SaveTo(stream);
}

exception: System.IO.IOException: Stream was too long.
at System.IO.MemoryStream.Write(Byte[] buffer, Int32 offset, Int32 count)
at SharpCompress.IO.CountingWritableSubStream.Write(Byte[] buffer, Int32 offset, Int32 count)
at SharpCompress.Compressors.Deflate.ZlibBaseStream.finish()
at SharpCompress.Compressors.Deflate.ZlibBaseStream.Dispose(Boolean disposing)
at System.IO.Stream.Close()
at SharpCompress.Compressors.Deflate.DeflateStream.Dispose(Boolean disposing)
at System.IO.Stream.Close()
at SharpCompress.Writers.Zip.ZipWriter.ZipWritingStream.Dispose(Boolean disposing)
at System.IO.Stream.Close()
at System.IO.Stream.Dispose()
at SharpCompress.Writers.Zip.ZipWriter.Write(String entryPath, Stream source, ZipWriterEntryOptions zipWriterEntryOptions)
at SharpCompress.Archives.Zip.ZipArchive.SaveTo(Stream stream, WriterOptions options, IEnumerable1 oldEntries, IEnumerable1 newEntries)
at SharpCompress.Archives.AbstractWritableArchive`2.SaveTo(Stream stream, WriterOptions options)

Originally created by @xhuan8 on GitHub (Apr 23, 2024). Hi, is it possible to turn on "x64" for large folder or this feature is not ready? ``` using (var archive = ZipArchive.Create()) { archive.AddAllFromDirectory(path); archive.SaveTo(stream); } ``` exception: System.IO.IOException: Stream was too long. at System.IO.MemoryStream.Write(Byte[] buffer, Int32 offset, Int32 count) at SharpCompress.IO.CountingWritableSubStream.Write(Byte[] buffer, Int32 offset, Int32 count) at SharpCompress.Compressors.Deflate.ZlibBaseStream.finish() at SharpCompress.Compressors.Deflate.ZlibBaseStream.Dispose(Boolean disposing) at System.IO.Stream.Close() at SharpCompress.Compressors.Deflate.DeflateStream.Dispose(Boolean disposing) at System.IO.Stream.Close() at SharpCompress.Writers.Zip.ZipWriter.ZipWritingStream.Dispose(Boolean disposing) at System.IO.Stream.Close() at System.IO.Stream.Dispose() at SharpCompress.Writers.Zip.ZipWriter.Write(String entryPath, Stream source, ZipWriterEntryOptions zipWriterEntryOptions) at SharpCompress.Archives.Zip.ZipArchive.SaveTo(Stream stream, WriterOptions options, IEnumerable`1 oldEntries, IEnumerable`1 newEntries) at SharpCompress.Archives.AbstractWritableArchive`2.SaveTo(Stream stream, WriterOptions options)
claunia added the enhancementup for grabs labels 2026-01-29 22:14:57 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/sharpcompress#630