In Powershell, how can i get a Base64encoded memorystream of a local zip file?
Try using the CopyTo
method to copy from one stream to another:
try { $zipFilePath = "index.zip" $zipFileItem = Get-Item -Path $zipFilePath $fileStream = $zipFileItem.OpenRead() $memoryStream = New-Object System.IO.MemoryStream $fileStream.CopyTo($memoryStream) Update-LMFunctionCode -FunctionName "PSDeployed" -ZipFile $memoryStream}finally { $fileStream.Close()}