async Task<StorageFile> DownloadFileAsync(File file) { StorageFolder temporaryFolder = ApplicationData.Current.TemporaryFolder; StorageFile invoice = await temporaryFolder.CreateFileAsync(file.Name, Windows.Storage.CreationCollisionOption.ReplaceExisting); var stream = await file.DownloadAsync(); using (var reader = new DataReader(stream.AsInputStream())) { await reader.LoadAsync((uint)stream.Length); var buffer = new byte[(int)stream.Length]; reader.ReadBytes(buffer); await FileIO.WriteBytesAsync(invoice, buffer); } return invoice; }