Show / Hide Table of Contents

How to download a filepath and binary file

////////////////////////////// Upload Test ////////////////////////////////////

string filePath = GlobalSettings.LargeFilePath; // This is a large file path
string filePathBinary = GlobalSettings.smallFilePath; // This is a small binary file
filesPath.Add(filePathBinary); // A file list (we need it later in this example to compare)

// A function that uploads the file path and the binary file and generates the link
var url = GenerateLinkForUploadedFile(filePath, filePathBinary);


////////////////////////////// Download Test ////////////////////////////////////

var msg = ReadMessage(url, "", ""); // Get the message


FileHelper down_fh = new FileHelper(); // We create a FileHelper to attach event to downloaded files

// Attaching event after each file download
down_fh.DownloadFinish_event += (DownloadedFileWithMetaData file) =>
{               
  var filePath = file.FilePath; // The final file path downloaded

  var fileName = file.FileName; // The final file name downloaded       

  var state = file.FileState; // The file state of the downloaded file. The state could be Process, NotProcess ...       

  var isFileUncrypted = file.Uncrypted; // Is the file has been successfly uncrypted           

  bool isSuccess = file.Success; //If the file is flagged has succces                 
};

// Attaching event after all download finished
down_fh.DownloadsFinish_event += (List<DownloadedFile> files) =>
{
  var numberOfFiles = files.Count; // Get the number of files in the collection
};

//After attachement we can start the download
down_fh.DownloadSecureFiles(msg.FilesMetaData, "./download folder");
Some classes and methods used in this article
  • FileHelper
In This Article
Back to top Generated by DocFX