示例#1
0
        public async Task <IFile> CopyFromAsync(IFile file, string targetPath)
        {
            Guard.ArgumentNotNull(file, nameof(file));
            if (!file.Exists)
            {
                throw new ArgumentException("要从中复制内容的源文件不存在。", nameof(file));
            }
            Guard.ArgumentIsRelativePath(targetPath, nameof(targetPath));
            string fullPath = _fileMapping.GetFilePath(targetPath, _scope);

            using (var fs = await file.CreateReadStreamAsync())
            {
                return(await CreateFileAsync(fullPath, fs));
            }
        }