Пример #1
0
 public async Task DownloadToStreamAsync(ObjectId id, Stream source, MediaTypeEnum bucketName)
 {
     var bucket = new GridFSBucket(_db, new GridFSBucketOptions
     {
         BucketName = bucketName.ToString()
     });
     
     await bucket.DownloadToStreamAsync(id, source);
 }
Пример #2
0
 /// <summary>
 /// Downloads a file stored in GridFS and writes the contents to a stream.
 /// </summary>
 /// <param name="id">The file id.</param>
 /// <param name="destination">The destination.</param>
 /// <param name="options">The options.</param>
 /// <param name="cancellationToken">The cancellation token.</param>
 /// <returns>A Task.</returns>
 public Task DownloadToStreamAsync(BsonValue id, Stream destination, GridFSDownloadOptions options = null, CancellationToken cancellationToken = default(CancellationToken))
 {
     return(_bsonValueBucket.DownloadToStreamAsync(id, destination, options, cancellationToken));
 }