Created
June 6, 2023 03:55
-
-
Save natesubra/5617121d64bb4a8885dc2f291f2804d4 to your computer and use it in GitHub Desktop.
Quick powershell port of inflate.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Requires -Version 5.0 | |
# Credit: https://github.com/njcve/inflate.py | |
param( | |
[Parameter(Mandatory = $true)] | |
[string] $InputFile, | |
[Parameter(Mandatory = $true)] | |
[string] $OutputFile, | |
[Parameter(Mandatory = $true)] | |
[int] $InflateSize = 100 | |
) | |
$bytesToAppend = $InflateSize * 1024 * 1024 | |
$padding = New-Object byte[] $bytesToAppend | |
try { | |
Copy-Item -Path $inputFile -Destination $OutputFile -Force | |
$mode = [System.IO.FileMode]::Append | |
$stream = [System.IO.File]::Open($OutputFile, $mode) | |
$bw = [System.IO.BinaryWriter]::new($stream) | |
$bw.Write($padding) | |
$bw.Flush() | |
$bw.Dispose() | |
$stream.Dispose() | |
} catch { | |
Write-Error $_.Exception.Message | |
exit 1 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment