/// <summary>
/// Sends file to R-Host by creating a new blob. This method adds the blob for clean up by default.
/// </summary>
/// <param name="filePath">Path to the file to be sent to R-Host.</param>
/// <param name="doCleanUp">
/// true to add blob created upon transfer for cleanup on dispose, false to ignore it after transfer.
/// </param>
public async Task <IRBlobInfo> SendFileAsync(string filePath, bool doCleanUp, IProgress <long> progress, CancellationToken cancellationToken)
{
IRBlobInfo blob = null;
using (RBlobStream blobStream = await RBlobStream.CreateAsync(_blobService))
using (Stream fileStream = _fs.FileOpen(filePath, FileMode.Open)){
await fileStream.CopyToAsync(blobStream, progress, cancellationToken);
blob = blobStream.GetBlobInfo();
}
if (doCleanUp)
{
_cleanup.Add(blob);
}
return(blob);
}