Save-GitHubReleaseAsset¶
SYNOPSIS¶
Downloads a GitHub Release asset.
SYNTAX¶
By Asset ID (Default)¶
Save-GitHubReleaseAsset -Owner <string> -Repository <string> -ID <string> [-Path <string>] [-Expand]
[-Force] [-PassThru] [-Context <Object>] [<CommonParameters>]
By Tag and Asset Name¶
Save-GitHubReleaseAsset -Owner <string> -Repository <string> -Tag <string> -Name <string>
[-Path <string>] [-Expand] [-Force] [-PassThru] [-Context <Object>] [<CommonParameters>]
By Release ID and Asset Name¶
Save-GitHubReleaseAsset -Owner <string> -Repository <string> -ReleaseID <string> -Name <string>
[-Path <string>] [-Expand] [-Force] [-PassThru] [-Context <Object>] [<CommonParameters>]
By Asset Object¶
Save-GitHubReleaseAsset -ReleaseAssetObject <GitHubReleaseAsset> [-Path <string>] [-Expand] [-Force]
[-PassThru] [-Context <Object>] [<CommonParameters>]
ALIASES¶
This cmdlet has the following aliases, {{Insert list of aliases}}
DESCRIPTION¶
Downloads an asset from a repository release.
The asset is downloaded as a file to the specified path
or the current directory by default.
Users must have read access to the repository.
For private repositories,
personal access tokens (classic) or OAuth tokens with the repo scope are required.
EXAMPLES¶
EXAMPLE 1¶
Save-GitHubReleaseAsset -Owner 'octocat' -Repository 'Hello-World' -ID '123456' -Path 'C:\Assets'
Output:
Directory: C:\Assets
Mode LastWriteTime Length Name
---- ------------- ------ ----
-a---- 03/31/2025 12:00 4194304 asset-123456.zip
Downloads release asset ID '123456' from the 'Hello-World' repository owned by 'octocat' to the specified path.
EXAMPLE 2¶
Save-GitHubReleaseAsset -Owner 'octocat' -Repository 'Hello-World' -Tag 'v1.0.0' -Name 'binary.zip' -Path 'C:\Assets\app' -Expand -Force
Output:
Directory: C:\Assets\app
Mode LastWriteTime Length Name
---- ------------- ------ ----
-a---- 03/31/2025 12:00 5120 config.json
-a---- 03/31/2025 12:00 4194304 application.exe
Downloads asset named 'binary.zip' from the release tagged as 'v1.0.0' in the 'Hello-World' repository owned by 'octocat' to the specified path, overwriting existing files during download and extraction.
EXAMPLE 3¶
$params = @{
Owner = 'octocat'
Repository = 'Hello-World'
ID = '123456'
Tag = 'v1.0.0'
Name = 'binary.zip'
}
Get-GitHubReleaseAsset @params | Save-GitHubReleaseAsset -Path 'C:\Assets' -Expand -Force
Pipes a release asset object directly to the Save-GitHubReleaseAsset function, which downloads and extracts it.
PARAMETERS¶
-Context¶
The context to run the command in. Used to get the details for the API call. Can be either a string or a GitHubContext object.
Type: System.Object
DefaultValue: ''
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
Position: Named
IsRequired: false
ValueFromPipeline: false
ValueFromPipelineByPropertyName: false
ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''
-Expand¶
When specified, the ZIP file is extracted to the same directory it was downloaded to.
Type: System.Management.Automation.SwitchParameter
DefaultValue: False
SupportsWildcards: false
Aliases:
- Extract
ParameterSets:
- Name: (All)
Position: Named
IsRequired: false
ValueFromPipeline: false
ValueFromPipelineByPropertyName: false
ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''
-Force¶
When specified, overwrites existing files during download and extraction.
Type: System.Management.Automation.SwitchParameter
DefaultValue: False
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
Position: Named
IsRequired: false
ValueFromPipeline: false
ValueFromPipelineByPropertyName: false
ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''
-ID¶
The unique identifier of the asset.
Type: System.String
DefaultValue: ''
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: By Asset ID
Position: Named
IsRequired: true
ValueFromPipeline: false
ValueFromPipelineByPropertyName: true
ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''
-Name¶
The name of the asset to download.
Type: System.String
DefaultValue: ''
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: By Tag and Asset Name
Position: Named
IsRequired: true
ValueFromPipeline: false
ValueFromPipelineByPropertyName: false
ValueFromRemainingArguments: false
- Name: By Release ID and Asset Name
Position: Named
IsRequired: true
ValueFromPipeline: false
ValueFromPipelineByPropertyName: false
ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''
-Owner¶
The account owner of the repository. The name is not case sensitive.
Type: System.String
DefaultValue: ''
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: By Tag and Asset Name
Position: Named
IsRequired: true
ValueFromPipeline: false
ValueFromPipelineByPropertyName: true
ValueFromRemainingArguments: false
- Name: By Release ID and Asset Name
Position: Named
IsRequired: true
ValueFromPipeline: false
ValueFromPipelineByPropertyName: true
ValueFromRemainingArguments: false
- Name: By Asset ID
Position: Named
IsRequired: true
ValueFromPipeline: false
ValueFromPipelineByPropertyName: true
ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''
-PassThru¶
When specified, the downloaded file or the folder where the ZIP file was extracted to is returned.
Type: System.Management.Automation.SwitchParameter
DefaultValue: False
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
Position: Named
IsRequired: false
ValueFromPipeline: false
ValueFromPipelineByPropertyName: false
ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''
-Path¶
Path to the file or folder for the download. Accepts relative or absolute paths.
Type: System.String
DefaultValue: $PWD.Path
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
Position: Named
IsRequired: false
ValueFromPipeline: false
ValueFromPipelineByPropertyName: false
ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''
-ReleaseAssetObject¶
The GitHubReleaseAsset object containing the information about the asset to download.
Type: GitHubReleaseAsset
DefaultValue: ''
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: By Asset Object
Position: Named
IsRequired: true
ValueFromPipeline: true
ValueFromPipelineByPropertyName: false
ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''
-ReleaseID¶
The unique identifier of the release.
Type: System.String
DefaultValue: ''
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: By Release ID and Asset Name
Position: Named
IsRequired: true
ValueFromPipeline: false
ValueFromPipelineByPropertyName: true
ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''
-Repository¶
The name of the repository without the .git extension. The name is not case sensitive.
Type: System.String
DefaultValue: ''
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: By Tag and Asset Name
Position: Named
IsRequired: true
ValueFromPipeline: false
ValueFromPipelineByPropertyName: true
ValueFromRemainingArguments: false
- Name: By Release ID and Asset Name
Position: Named
IsRequired: true
ValueFromPipeline: false
ValueFromPipelineByPropertyName: true
ValueFromRemainingArguments: false
- Name: By Asset ID
Position: Named
IsRequired: true
ValueFromPipeline: false
ValueFromPipelineByPropertyName: true
ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''
-Tag¶
The tag name of the release.
Type: System.String
DefaultValue: ''
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: By Tag and Asset Name
Position: Named
IsRequired: true
ValueFromPipeline: false
ValueFromPipelineByPropertyName: true
ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''
CommonParameters¶
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.
INPUTS¶
GitHubReleaseAsset¶
{{ Fill in the Description }}
System.String¶
{{ Fill in the Description }}
OUTPUTS¶
System.IO.FileSystemInfo¶
{{ Fill in the Description }}
NOTES¶
Contains the extracted file or folder information from the downloaded asset. This output can include directories or files depending on the asset content.