public Stream Get(string key) { var stream = new MemoryStream(); _fs.DownloadToStream(ObjectId.Parse(key), stream); stream.Position = 0; return(stream); }
private void DownloadingFile(string id, Stream destination) { IGridFSBucket bucket = GetGridFSBucket(); ObjectId objectId = new ObjectId(id); bucket.DownloadToStream(objectId, destination); //The driver does not close the Stream when it is done. }
public void GetFile(ObjectId id, Stream destination) { if (id == null) { throw new ArgumentNullException(nameof(id)); } if (destination == null) { throw new ArgumentNullException(nameof(destination)); } _gridFsBucket.DownloadToStream(id, destination); }