title: Unzipping a GZip with PowerShell works but can I extract directly to file?
body: <p>Internet is an amazing place to be, I found <a href="https://scatteredcode.net/download-and-extract-gzip-tar-with-powershell/" rel="nofollow noreferrer">this code</a> that allows me to inflate a <code>tar.gz</code> file to <code>.tar</code>:</p>
  <pre><code>Function DeGZip-File{
      Param(
          $infile,
          $outfile = ($infile -replace '\.gz$','')
          )
      $input = New-Object System.IO.FileStream $inFile, ([IO.FileMode]::Open), ([IO.FileAccess]::Read), ([IO.FileShare]::Read)
      $output = New-Object System.IO.FileStream $outFile, ([IO.FileMode]::Create), ([IO.FileAccess]::Write), ([IO.FileShare]::None)
      $gzipStream = New-Object System.IO.Compression.GzipStream $input, ([IO.Compression.CompressionMode]::Decompress)
      $buffer = New-Object byte[](1024)
      while($true){
          $read = $gzipstream.Read($buffer, 0, 1024)
          if ($read -le 0){break}
          $output.Write($buffer, 0, $read)
          }
      $gzipStream.Close()
      $output.Close()
      $input.Close()
  }
  DeGZip-File &quot;C:\temp\maxmind\temp.tar.gz&quot; &quot;C:\temp\maxmind\temp.tar&quot;
  </code></pre>
  <p>Now I have a <code>.tar</code> file in my hands. but how can I open that?</p>
  <p>My goal is to extract directly from <code>.tar.gz</code> to file.</p>