Пример #1
0
        /// <summary>
        /// Copy all file content to a steam
        /// </summary>
        public void Download(string id, Stream stream)
        {
            if (stream == null)
            {
                throw new ArgumentNullException("stream");
            }

            var file = this.FindById(id);

            if (file == null)
            {
                throw S3NoSqlException.FileNotFound(id);
            }

            file.CopyDataTo(stream);
        }
Пример #2
0
        /// <summary>
        /// Load data inside storage and returns as Stream
        /// </summary>
        public Stream OpenRead(string id)
        {
            if (string.IsNullOrEmpty(id))
            {
                throw new ArgumentNullException("id");
            }

            var file = this.FindById(id);

            if (file == null)
            {
                throw S3NoSqlException.FileNotFound(id);
            }

            return(file.OpenReadData());
        }