Implemented upload and downloading in daemon, api server and frontend
This commit is contained in:
@@ -45,7 +45,7 @@ public class ServerFileSystemService
|
||||
public async Task Upload(int serverId, string path, Stream dataStream)
|
||||
{
|
||||
var uploadSession = await ApiClient.GetJson<ServerFilesUploadResponse>(
|
||||
$"api/client/servers/{serverId}/files/upload?path={path}"
|
||||
$"api/client/servers/{serverId}/files/upload"
|
||||
);
|
||||
|
||||
using var httpClient = new HttpClient();
|
||||
@@ -55,4 +55,15 @@ public class ServerFileSystemService
|
||||
|
||||
await httpClient.PostAsync(uploadSession.UploadUrl, content);
|
||||
}
|
||||
|
||||
public async Task<Stream> Download(int serverId, string path)
|
||||
{
|
||||
var downloadSession = await ApiClient.GetJson<ServerFilesDownloadResponse>(
|
||||
$"api/client/servers/{serverId}/files/download?path={path}"
|
||||
);
|
||||
|
||||
using var httpClient = new HttpClient();
|
||||
|
||||
return await httpClient.GetStreamAsync(downloadSession.DownloadUrl);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user