Skip to content

Commit

Permalink
Update BinaryService.cs
Browse files Browse the repository at this point in the history
  • Loading branch information
rosolko authored Jun 7, 2024
1 parent 55018e4 commit 5ebb6c4
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions WebDriverManager/Services/Impl/BinaryService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -190,13 +190,14 @@ protected string UnZip(string path, string destination, string name)
if (zipEntry.Name.EndsWith(name) && zipEntry.IsFile)
{
byte[] buffer = new byte[4096];
Stream zipStream = zip.GetInputStream(zipEntry);

// Unzip file in buffered chunks. This is just as fast as unpacking to a buffer the full size
// of the file, but does not waste memory.
using (FileStream streamWriter = File.Create(destination))
using (Stream zipStream = zip.GetInputStream(zipEntry))
{
StreamUtils.Copy(zipStream, streamWriter, buffer);
// Unzip file in buffered chunks. This is just as fast as unpacking to a buffer the full size
// of the file, but does not waste memory.
using (FileStream streamWriter = File.Create(destination))
{
StreamUtils.Copy(zipStream, streamWriter, buffer);
}
}
}
}
Expand Down

0 comments on commit 5ebb6c4

Please sign in to comment.