对象存储 OSS只获取文件元信息
详细解答可以参考官方帮助文档通过headObject方法可以只获文件元信息而不获取文件的实体。代码如下:
OSSHeadObjectRequest * request = [OSSHeadObjectRequest new];request.bucketName = @';request.objectKey = @'';OSSTask * headTask = [client headObject:request];[headTask continueWithBlock:^id(OSSTask *task) { if (!task.error) { NSLog(@'head object success!'); OSSHeadObjectResult * result = task.result; NSLog(@'header fields: %@', result.httpResponseHeaderFields); for (NSString * key in result.objectMeta) { NSLog(@'ObjectMeta: %@ - %@', key, [result.objectMeta objectForKey:key]); } } else { NSLog(@'head object failed, error: %@' ,task.error); } return nil;}];
赞0
踩1