Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/russkyc/github-release-downloader
A small set of classes to download github release assets https://www.nuget.org/packages/GithubReleaseDownloader
https://github.com/russkyc/github-release-downloader
csharp dotnet downloader github github-assets github-assets-downloader github-client github-downloader github-release-assets github-releases nuget toolkit
Last synced: about 2 months ago
JSON representation
A small set of classes to download github release assets https://www.nuget.org/packages/GithubReleaseDownloader
- Host: GitHub
- URL: https://github.com/russkyc/github-release-downloader
- Owner: russkyc
- License: mit
- Created: 2023-11-02T13:07:48.000Z (about 1 year ago)
- Default Branch: master
- Last Pushed: 2023-11-02T13:35:23.000Z (about 1 year ago)
- Last Synced: 2024-11-21T08:46:12.966Z (about 2 months ago)
- Topics: csharp, dotnet, downloader, github, github-assets, github-assets-downloader, github-client, github-downloader, github-release-assets, github-releases, nuget, toolkit
- Language: C#
- Homepage:
- Size: 1.75 MB
- Stars: 2
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
GithubReleaseDownloader
If you just want to download assets with very minimal code, we got you!
All you need to know is the public repository name and owner, and you can download release
assets easily. No need to setup api keys and clients.## Simple console demo
I think it's easier to show how it works, here is a simple console demo
to download assets from the latest release of `fossa-client-desktop````csharp
using GithubReleaseDownloader;namespace ConsoleApp;
public static class Program
{
public static void Main()
{
// The owner and repo to download from, and target path
var owner = "libremindsph";
var repo = "fossa-client-desktop";
var downloadPath = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);// Get last release using .GetLatest(), can substitute with other available methods
var release = ReleaseManager.Instance.GetLatest(owner, repo);
if (release is null) return;
// In this case, we download all assets
AssetDownloader.Instance .DownloadAllAssets(release, downloadPath);
}}
```And done! That easy. If you need to monitor the progress, we also got you covered. just use the `progressChanged`
callback.```csharp
using GithubReleaseDownloader;
using GithubReleaseDownloader.Entities;namespace ConsoleApp;
public static class Program
{
public static void Main()
{
// The owner and repo to download from, and target path
var owner = "libremindsph";
var repo = "fossa-client-desktop";
var downloadPath = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);// Get last release using .GetLatest(), can substitute with other available methods
var release = ReleaseManager.Instance.GetLatest(owner, repo);
if (release is null) return;
// In this case, we download all assets
AssetDownloader.Instance.DownloadAllAssets(release,downloadPath, progressChanged: RunOnProgressChanged);
}// This is being executed when the progress changes
private static void RunOnProgressChanged(DownloadInfo downloadInfo)
{
if (downloadInfo.DownloadPercent == 1.0)
{
Console.WriteLine($"Finished downloading: {downloadInfo.Name}");
return;
}if (downloadInfo.DownloadPercent == 0)
{
Console.WriteLine($"Start downloading: {downloadInfo.Name}");
return;
}
Console.WriteLine($"Progress({downloadInfo.Name}): {downloadInfo.DownloadPercent:P}");
}
}
```## Installation
Nuget Cli `dotnet add package GithubReleaseDownloader --version 1.0.0`
Nuget Link https://www.nuget.org/packages/GithubReleaseDownloader/1.0.0
## Available Methods### :star: Release Manager
| **Method** | **Description** | **Parameters** |
|-----------------------|-----------------------------------------------------|-------------------------------------------------|
| **GetWithTag()** | Gets a release from the repo with the specified tag | string: owner
string: repo
string: tag |
| **GetWithTagAsync()** | Asynchronous overload of `GetWithTag()` | string: owner
string: repo
string: tag |
| **GetLatest()** | Gets the latest release from the repo | string: owner
string: repo
|
| **GetLatestAsync()** | Asynchronous overload of `GetLatest()` | string: owner
string: repo
|
| **GetAll()** | Gets all releases from the repo | string: owner
string: repo
|
| **GetAllAsync()** | Asynchronous overload of `GetAll()` | string: owner
string: repo
|### :arrow_down: Asset Downloader
Only the parameters with an asterisk `*` are required, the rest are optional
| **Method** | **Description** | **Parameters** |
|----------------------------|------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------|
| `DownloadAllAssets()` | Downloads all release assets | `Release`: release*
`string`: savePath*
`Action` progressChanged |
| `DownloadAllAssetsAsync()` | Asynchronous overload of `DownloadAllAssets()` | `Release`: release*
`string`: savePath*
`Action` progressChanged |
| `DownloadAssets()` | Downloads selected release assets | `IEnumerable` assets*
`string` savePath*
`Action` progressChanged |
| `DownloadAssetsAsync()` | Asynchronous overload of `DownloadAssets()` | `IEnumerable` assets*
`string` savePath*
`Action` progressChanged |
| `DownloadAsset()` | Downloads a single release asset | `IEnumerable` assets*
`string` savePath*
`string` fileName
`Action` progressChanged |
| `DownloadAssetAsync()` | Asynchronous overload of `DownloadAsset()` | `IEnumerable` assets*
`string` savePath*
`string` fileName
`Action` progressChanged |## Support
I do this freely to help the community :heart:, but supporting this project means I can afford more
time to spend in these projects. Who knows, we might be able to create
something even more awesome! Click on the sponsor button in this repository to show some love for this project :heart:## Special Message
This project was developed with the help of jetbrains products, thank you [JetBrains](https://www.jetbrains.com/) for supporting this project by providing licences to the JetBrains Suite!