예제 #1
0
        /// <summary>
        /// Load data inside storage and returns as Stream
        /// </summary>
        public LiteFileStream OpenRead(string id)
        {
            var file = FindById(id);

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

            return(file.OpenRead());
        }
예제 #2
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 = FindById(id);

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

            file.CopyTo(stream);

            return(file);
        }