I am trying to download an asset from CodeArtifact, in this case it is a zip file.
I know how to do it using AWS CLI but we are a PowerShell shop so I want to use the AWSPowerShell library function.
This is what I have:
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
This returns an object of type Amazon.CodeArtifact.Model.GetPackageVersionAssetResponse
. That object has a property Asset
of type Amazon.Runtime.Internal.Util.CachingWrapperStream
.
I have been unable to figure out how to use the returned object to actually download the file.
The AWS CLI equivalent command (aws codeartifact get-package-version-asset
) has an argument for download path. As far as I can tell, the PowerShell command has no such thing.
How do I actually download the asset using PowerShell?
I played around with the idea of downloading from the stream and got this to work: