예제 #1
0
        /// <summary>
        /// Copy all file content to a file
        /// </summary>
        public LiteFileInfo <TFileId> Download(TFileId id, string filename, bool overwritten)
        {
            var file = this.FindById(id) ?? throw LiteException.FileNotFound(id.ToString());

            file.SaveAs(filename, overwritten);

            return(file);
        }
예제 #2
0
        /// <summary>
        /// Copy all file content to a steam
        /// </summary>
        public LiteFileInfo <TFileId> Download(TFileId id, Stream stream)
        {
            var file = this.FindById(id) ?? throw LiteException.FileNotFound(id.ToString());

            file.CopyTo(stream);

            return(file);
        }
예제 #3
0
        /// <summary>
        /// Load data inside storage and returns as Stream
        /// </summary>
        public LiteFileStream <TFileId> OpenRead(TFileId id)
        {
            var file = this.FindById(id);

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

            return(file.OpenRead());
        }
예제 #4
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 LiteException.FileNotFound(id);
            }

            file.CopyTo(stream);
        }
예제 #5
0
        /// <summary>
        /// Load data inside storage and returns as Stream
        /// </summary>
        public LiteFileStream OpenRead(string id)
        {
            if (string.IsNullOrEmpty(id))
            {
                throw new ArgumentNullException("id");
            }

            var file = this.FindById(id);

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

            return(file.OpenRead());
        }
예제 #6
0
        /// <summary>
        /// Copy all file content to a steam
        /// </summary>
        public LiteFileInfo Download(string id, Stream stream)
        {
            if (stream == null)
            {
                throw new ArgumentNullException(nameof(stream));
            }

            var file = this.FindById(id);

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

            file.CopyTo(stream);

            return(file);
        }