public IEnumerable <IFileInfo> GetFilesInfo(string path) { string key = GetKey(path); ListObjectsRequest request = new ListObjectsRequest { BucketName = _bucketName, Prefix = key.Length > 1 ? key : string.Empty, Delimiter = PathDelimiter.ToString() }; ListObjectsResponse response = _client.ListObjects(request); List <IFileInfo> files = new List <IFileInfo>(); // add directories foreach (string directory in response.CommonPrefixes) { IFileInfo file = new GroupDocs.Viewer.Storage.FileInfo(); file.Path = directory; file.IsDirectory = true; files.Add(file); } // add files foreach (S3Object entry in response.S3Objects) { IFileInfo fileDescription = new GroupDocs.Viewer.Storage.FileInfo { Path = entry.Key, IsDirectory = false, LastModified = entry.LastModified, Size = entry.Size }; files.Add(fileDescription); } return(files); }
public IFileInfo GetFileInfo(string path) { string key = GetKey(path); GetObjectMetadataRequest request = new GetObjectMetadataRequest { BucketName = _bucketName, Key = key }; GetObjectMetadataResponse response = _client.GetObjectMetadata(request); IFileInfo file = new GroupDocs.Viewer.Storage.FileInfo(); file.Path = path; file.Size = response.ContentLength; file.LastModified = response.LastModified; file.IsDirectory = false; return(file); }