Download Folder from S3 to Local Folder of UWP

0

I am working with a UWP application and AWS S3. The application streams videos and images via S3 using a link. Now I want to provide an offline functionality to the application where I can pull down the contents of the S3 (basically a folder from it approx 2GB) to Application LocalFolder UWP and show progress of the download.

Below is what I have:

public class S3Service
{

    private readonly IAmazonS3 _client;


    public S3Service() =>
        _client = new AmazonS3Client(Constants.S3AccessKey, Constants.S3AccessSecret, RegionEndpoint.APSouth1);

    public async Task DownloadContent()
    {
        var request = new GetObjectRequest
        {
            BucketName = Constants.S3BucketName,
            Key = Constants.BackboneFileName
        };

        using (var response = await _client.GetObjectAsync(request))
        {
            response.WriteObjectProgressEvent += Response_WriteObjectProgressEvent;
            Windows.Storage.StorageFolder localFolder = Windows.Storage.ApplicationData.Current.LocalFolder;
            await response.WriteResponseStreamToFileAsync(localFolder.Path, false);
        }
    }

    private static void Response_WriteObjectProgressEvent(object sender, WriteObjectProgressArgs e)
    {

    }
}

But this doesn't seem to work.

System.IO.FileNotFoundException: 'The filename, directory name, or volume label syntax is incorrect. (Exception from HRESULT: 0x8007007B)'

The localFolder.Path returns : "C:\Users\Carrot\AppData\Local\Packages\MY_PROJECT_WITH_APP_ID\LocalCache"

Am I missing something?

amazon-s3
uwp
aws-sdk-net
asked on Stack Overflow Mar 1, 2020 by iam.Carrot • edited Mar 1, 2020 by iam.Carrot

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0