title: Read blob zip file directly without writing it to disk
body: <p>I'm using ODP.net with Powershell to get blob zipped file.</p>
  
  <pre><code>[void][System.Reflection.Assembly]::LoadFile("C:\DLL\Oracle.ManagedDataAccess.dll")
  $OracleConnexion = New-Object Oracle.ManagedDataAccess.Client.OracleConnection('User Id=test;Password="test";Data Source=10.2.2.1/TEST')
  
  $OracleConnexion.Open()
  $Query=$OracleConnexion.CreateCommand()
  $Query.CommandText="SELECT BLOB from MyTable Where ID=01"
  $ExecuteQuery=$Query.ExecuteReader()
  
  $Path = "C:\temp"
  
  while ($ExecuteQuery.Read()){
  
     $Localfile = New-Object IO.FileStream("$($Path)\$($ExecuteQuery["LOG_ID"]).zip",[IO.FileMode]::Create)
     $Localfile.Write($ExecuteQuery["XML_TRACE"],0,$ExecuteQuery["XML_TRACE"].Length)
     $Localfile.Close()
  
     $Zip = [io.compression.zipfile]::OpenRead("$($Path)\$($Executequery["LOG_ID"]).zip")
     $Stream = $Zip.Entries.Open()
     $Reader = New-Object IO.StreamReader($stream)
     $XML = $Reader.ReadToEnd()
  
     $Reader.Close()
     $Stream.Close()
     $Zip.Dispose()
  
      }
  </code></pre>
  
  <p>As you can see, first I'm writing file to disk with <code>$Localfile.Write</code> then with <code>[io.compression.zipfile]::OpenRead</code> i'm reading the content of my zipped file.</p>
  
  <p>My code works, but I want to read my blob directly as zip file without writing it to disk, something like this : </p>
  
  <pre><code>  while ($ExecuteQuery.Read()){
  
     $Zip = [io.compression.zipfile]::OpenRead($ExecuteQuery["XML_TRACE"]).zip)
     $Stream = $Zip.Entries.Open()
     $Reader = New-Object IO.StreamReader($stream)
     $XML = $Reader.ReadToEnd()
     $XML
  
     $Reader.Close()
     $Stream.Close()
     $Zip.Dispose()
  
      }
  </code></pre>
  
  <p><strong>EDIT : it works with ionic !</strong>  </p>
  
  <pre><code>   while ($ExecuteRequete.Read()){
  $ZipStream = New-Object System.IO.Memorystream
  $ZipStream.Write($ExecuteRequete["XML_TRACE"],0,$ExecuteRequete["XML_TRACE"].Length)
  $ZipStream.Position = 0
  $Zip = [Ionic.Zip.ZipFile]::Read($ZipStream)
  
  $Stream = New-Object IO.MemoryStream
  $Zip.Extract($Stream)
  $stream.Position = 0
  
  $Reader = New-Object IO.StreamReader($stream)
  $XML = $Reader.ReadToEnd()
  
  $Reader.Close()
  $Stream.Close()
  $ZipStream.Dispose()
  $Zip.Dispose()
   }
  </code></pre>