Microsoft.R.Host.Client.RBlobStream.OpenAsync C# (CSharp) Method

OpenAsync() public static method

public static OpenAsync ( IRBlobInfo blobInfo, IRBlobService blobService, CancellationToken ct = default(CancellationToken) ) : Task
blobInfo IRBlobInfo
blobService IRBlobService
ct System.Threading.CancellationToken
return Task
        public static Task<RBlobStream> OpenAsync(IRBlobInfo blobInfo, IRBlobService blobService, CancellationToken ct = default(CancellationToken)) {
            return Task.FromResult(Open(blobInfo, blobService));
        }

Usage Example

Example #1
0
        /// <summary>
        /// Gets the data for a given blob from R-Host. Saves the data to <paramref name="filePath"/>. This
        /// method adds the blob for clean up by default.
        /// </summary>
        /// <param name="blob">Blob from which the data is to be retrieved.</param>
        /// <param name="filePath">Path to the file where the retrieved data will be written.</param>
        /// <param name="doCleanUp">true to add blob upon transfer for cleanup on dispose, false to ignore it after transfer.</param>
        public async Task FetchFileAsync(IRBlobInfo blob, string filePath, bool doCleanUp, IProgress <long> progress, CancellationToken cancellationToken)
        {
            using (RBlobStream blobStream = await RBlobStream.OpenAsync(blob, _blobService))
                using (Stream fileStream = _fs.CreateFile(filePath)) {
                    await blobStream.CopyToAsync(fileStream, progress, cancellationToken);
                }

            if (doCleanUp)
            {
                _cleanup.Add(blob);
            }
        }
All Usage Examples Of Microsoft.R.Host.Client.RBlobStream::OpenAsync