CodeArtifact - how to download a package using AWS PowerShell

0

I have figured how to download a package from CodeArtifact using AWS CLI but we are very much a PowerShell shop. This is how I tried to download a package using PowerShell:

$buildPackage = Get-CAPackageVersionAsset -Asset MyApp.3.55.31.zip -Domain my-packages -DomainOwner <my-account-id> -Format generic -Namespace my-namespace -Package MyApp -PackageVersion 3.55.31 -Repository my-builds
$buildPackage

That returns an object like this Asset AssetName PackageVersion PackageVersionRevision


Amazon.Runtime.Internal.Util.CachingWrapperStream MyApp.3.55.31.zip 3.55.31 <revision-id>

I've tried to get the package from the Stream but there are too many methods - I just can't see how to do it.

Anyone have experience with this?

preguntada hace 6 meses242 visualizaciones
1 Respuesta
0

I played around with downloading from the returned stream and got this to work:

$buildPackage = Get-CAPackageVersionAsset -Asset MyAsset.3.55.98.zip -Domain mydomain -DomainOwner <aws_account_id> -Format generic -Namespace mynamespace -Package MyAsset -PackageVersion 3.55.98 -Repository myrepo

    $ms = New-Object System.IO.MemoryStream
    $buildPackage.Asset.CopyTo($ms)
    $bytes = $ms.ToArray()
    [IO.File]::WriteAllBytes($DownloadPath, $bytes)
respondido hace 6 meses
profile picture
EXPERTO
revisado hace un mes

No has iniciado sesión. Iniciar sesión para publicar una respuesta.

Una buena respuesta responde claramente a la pregunta, proporciona comentarios constructivos y fomenta el crecimiento profesional en la persona que hace la pregunta.

Pautas para responder preguntas