feat: integrate Forgejo API for release synchronization and asset download
This commit is contained in:
1 parent
7fa501266e
commit
7b43e47a64
7 files changed
+225
-32
No files matched your search
@@ -0,0 +1,14 @@
|
||||
namespace ForgejoReleaseSync.Services;
|
||||
|
||||
public class ReleaseAssetDownloadService(HttpClient httpClient)
|
||||
{
|
||||
public async Task<string> DownloadReleaseAssetAsync(Uri url)
|
||||
{
|
||||
var fileName = Path.GetFileName(url.AbsoluteUri);
|
||||
var filePath = Path.Combine(Path.GetTempPath(), fileName);
|
||||
await using Stream resource = await httpClient.GetStreamAsync(url);
|
||||
await using FileStream fs = new FileStream(filePath, FileMode.OpenOrCreate);
|
||||
await resource.CopyToAsync(fs, 8192);
|
||||
return filePath;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user