Esempio n. 1
0
        public async Task<byte[]> DownloadAsBytesAsync(ObjectId id, MediaTypeEnum bucketName)
        {
            var bucket = new GridFSBucket(_db, new GridFSBucketOptions
            {
                BucketName = bucketName.ToString()
            });

            return await bucket.DownloadAsBytesAsync(id);
        }
Esempio n. 2
0
 /// <summary>
 /// Downloads a file stored in GridFS and returns it as a byte array.
 /// </summary>
 /// <param name="id">The file id.</param>
 /// <param name="options">The options.</param>
 /// <param name="cancellationToken">The cancellation token.</param>
 /// <returns>A Task whose result is a byte array containing the contents of the file stored in GridFS.</returns>
 public Task <byte[]> DownloadAsBytesAsync(BsonValue id, GridFSDownloadOptions options = null, CancellationToken cancellationToken = default(CancellationToken))
 {
     return(_bsonValueBucket.DownloadAsBytesAsync(id, options, cancellationToken));
 }