Exemplo n.º 1
0
        public Stream Get(string key)
        {
            var stream = new MemoryStream();

            _fs.DownloadToStream(ObjectId.Parse(key), stream);
            stream.Position = 0;
            return(stream);
        }
Exemplo n.º 2
0
        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.
        }
Exemplo n.º 3
0
        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);
        }