-
我现在已经下载了C-OBS,并且已经编译成功获得了库文件,如何将这些库文件导入到C++项目中呢,请给出详细的操作及设置步骤,需要设置哪些路径等等,我是一名小白,希望得到大家的帮助,谢谢!
-
const obs_client = new ObsClient( { access_key_id: this.OBS_data.access_key_id, // 你的ak secret_access_key: this.OBS_data.secret_access_key, // 你的sk server: this.OBS_data.endpoint, // 你的endPoint } ) // 下载对象的目标路径,包含文件名。 const SaveAsFile = 'C:\Windows\zbcfile'; obs_client.getObject({ Bucket: this.OBS_data.bucket_name, Key: file.name, // SaveAsFile, // SaveAsStream: true }, (err, result) => { if (err) { console.log('GetObject Failed') console.error('Error-->' + err); } else { if (result.CommonMsg.Status < 300) { console.log(result.InterfaceResult.Content) //文件流进行下载--------------------------------------------------- // this_.$downloadBlob(new Blob([result.InterfaceResult.Content],{type:result.InterfaceResult.ContentType}), file.name); // 拼接的文件地址下载----------------------------- // const fileUrl = `http://${this.OBS_data.bucket_name}.${this.OBS_data.endpoint}/${file.name}` // const link = document.createElement('a'); // link.href = fileUrl; // link.style.display = 'none'; // document.body.appendChild(link); // link.click(); // document.body.removeChild(link); } else { console.log('GetObject Failed') console.log('ErrorCode-->' + result.CommonMsg.Code); console.log('ErrorMessage-->' + result.CommonMsg.Message); } } });
-
使用流式上传后台报错:
-
@PostMapping("/uploadPart1") public String uploadPart1(MultipartFile file) throws Exception { List<PartEtag> partEtags = Collections.synchronizedList(new ArrayList<PartEtag>()); String objectKey = String.valueOf(UUID.randomUUID()); // 1、获取uploadId InitiateMultipartUploadRequest request = new InitiateMultipartUploadRequest(obsEntity.getBucketName(), keySuffixWithSlash + objectKey); InitiateMultipartUploadResult result = obsClient.initiateMultipartUpload(request); String uploadId = result.getUploadId(); // 2、分段上传 long partSize = 1*1024*1024; // 1MB long fileLength = file.getSize(); long partCount = fileLength % partSize == 0 ? fileLength / partSize : fileLength / partSize + 1; if(partCount > 10000) { throw new Exception(); } InputStream inputStream = file.getInputStream(); for (long i = 0; i < partCount; i++) { long offset = i * partSize; long currPartSize = (i + 1 == partCount) ? fileLength - offset : partSize; UploadPartRequest uploadPartRequest = new UploadPartRequest(); uploadPartRequest.setBucketName(obsEntity.getBucketName()); uploadPartRequest.setObjectKey(keySuffixWithSlash + objectKey); uploadPartRequest.setUploadId(uploadId); uploadPartRequest.setInput(inputStream); uploadPartRequest.setPartSize(currPartSize); uploadPartRequest.setOffset(offset); uploadPartRequest.setPartNumber((int) (i+1)); UploadPartResult uploadPartResult = obsClient.uploadPart(uploadPartRequest); partEtags.add(new PartEtag(uploadPartResult.getEtag(), uploadPartResult.getPartNumber())); } if(partEtags.size() != partCount) { throw new Exception(); }// listAllParts(uploadId,objectKey); // 3、开启聚合 Collections.sort(partEtags, new Comparator<PartEtag>() { @Override public int compare(PartEtag o1, PartEtag o2) { return o1.getPartNumber() - o2.getPartNumber(); } }); CompleteMultipartUploadRequest completeMultipartUploadRequest = new CompleteMultipartUploadRequest(obsEntity.getBucketName(), keySuffixWithSlash + objectKey, uploadId, partEtags); obsClient.completeMultipartUpload(completeMultipartUploadRequest); return "success"; }用postman调用接口,总是报
-
状况描述:1、自己创建word文档并用obs-browser上传到OBS,然后通过页面下载,能打开文件;2、服务器后台程序通过PutObject转移到OBS的大量文档,通过页面下载后打不开,但是用obs-browser下载来可以打开。不知缺少什么没有设置?控制器返回FileContentResult,代码如下或者有更好的方式,望指点。谢谢:public FileContentResult Download(int id){ ObsConfig config = new ObsConfig(); config.Endpoint = "https://obs.cn-north-4.myhuaweicloud.com"; string bucketName = "mybucketName"; string accessKey = Environment.GetEnvironmentVariable("AccessKeyID", EnvironmentVariableTarget.Machine); string secretKey = Environment.GetEnvironmentVariable("SecretAccessKey", EnvironmentVariableTarget.Machine); ObsClient client = new ObsClient(accessKey, secretKey, config); //string obsurl = "%E6%A1%B6%E7%AD%96%E7%95%A5.png"; string obsurl = "%E4%B8%80%E4%B8%AA%20%E8%87%AA%E5%BB%BA%20%E6%96%87%E6%A1%A3.docx"; //string obsurl = "3/113/3/20210406092732/some.docx"; string utfurl = HttpUtility.UrlDecode(obsurl); GetObjectRequest request = new GetObjectRequest() { BucketName = bucketName, ObjectKey = utfurl }; string contentType = string.Empty; byte[] bytes = null; using (GetObjectResponse response = client.GetObject(request)) { contentType = response.ContentType; bytes = new byte[response.ContentLength]; response.OutputStream.Read(bytes, 0, bytes.Length); } return new FileContentResult(bytes, contentType) { FileDownloadName = "一个 自建 文档.docx" };}
-
BrowserJS 是否能删除文件夹
-
obs 有支持开发者支持 文件夹重命名的api 方案吗,还是只能一个一个去复制粘贴
-
https://support.huaweicloud.com/sdk-java-devg-obs/obs_21_0901.html通过临时URL访问OBS(Java SDK)调用该接口生成url,浏览器直接访问下载,总是报错:The request signature we calculated does not match the signature you provided. Check your key and signing method.
-
之前用的阿里云,实现代码如下: DefaultProfile profile = DefaultProfile.getProfile( OssConfiguration.region, OssConfiguration.accessKey, OssConfiguration.secretKey); IAcsClient client = new DefaultAcsClient(profile); AssumeRoleRequest request = new AssumeRoleRequest(); request.setDurationSeconds(OssConfiguration.expire); request.setRoleArn(OssConfiguration.roleArn); request.setRoleSessionName(OssConfiguration.roleSessionName); AssumeRoleResponse.Credentials response = client.getAcsResponse(request).getCredentials(); 切换到华为云,代码要怎么实现呢, 使用到哪些类?
-
使用的是最新版本的、、、、、、、、、、
-
Execution failed for task ':driver:compileDebugJavaWithJavac'. > Could not resolve all files for configuration ':driver:debugCompileClasspath'. > Failed to transform jackson-core-2.15.2.jar (com.fasterxml.jackson.core:jackson-core:2.15.2) to match attributes {artifactType=android-classes-jar, org.gradle.category=library, org.gradle.dependency.bundling=external, org.gradle.libraryelements=jar, org.gradle.status=release, org.gradle.usage=java-api}. > Execution failed for JetifyTransform: C:\Users\Administrator\.gradle\caches\modules-2\files-2.1\com.fasterxml.jackson.core\jackson-core\2.15.2\a6fe1836469a69b3ff66037c324d75fc66ef137c\jackson-core-2.15.2.jar. > Failed to transform 'C:\Users\Administrator\.gradle\caches\modules-2\files-2.1\com.fasterxml.jackson.core\jackson-core\2.15.2\a6fe1836469a69b3ff66037c324d75fc66ef137c\jackson-core-2.15.2.jar' using Jetifier. Reason: IllegalArgumentException, message: Unsupported class file major version 61. (Run with --stacktrace for more details.) Suggestions: - Check out existing issues at https://issuetracker.google.com/issues?q=componentid:460323&s=modified_time:desc, it's possible that this issue has already been filed there. - If this issue has not been filed, please report it at https://issuetracker.google.com/issues/new?component=460323 (run with --stacktrace and provide a stack trace if possible).
-
OBS SDK中,C语言的SDK为啥某些函数不支持 https://bbs.huaweicloud.com/forum/thread-0266152380110309019-1-1.html OBS有那么多不同语言的SDK,哪种上传/下载速度最快 https://bbs.huaweicloud.com/forum/thread-0249152379563688026-1-1.html OBS怎么给桶分配权限 https://bbs.huaweicloud.com/forum/thread-0266152379283948018-1-1.html OBS中的并行文件系统是什么原理?比起传统文件系统改进在哪里 https://bbs.huaweicloud.com/forum/thread-0297152378512172029-1-1.html OBS中的Metadata 和 Data 有什么区别 https://bbs.huaweicloud.com/forum/thread-0297152378114343028-1-1.html OBS上传图片(假设图片比较大,有15MB左右)后,问大概多久能生成缩略图 https://bbs.huaweicloud.com/forum/thread-0297152349334607020-1-1.html 在手机上通过Java OBS SDK上传文件,推荐开几个并发?为什么? https://bbs.huaweicloud.com/forum/thread-0266152349263905013-1-1.html OBS JavaScript的SDK在哪里下载? https://bbs.huaweicloud.com/forum/thread-0297152349219764019-1-1.html 前端使用browserjs实现断点续传,上传过程中关闭浏览器,再次打开浏览器进入对应上传页面,无法再续传文件 https://bbs.huaweicloud.com/forum/thread-0220152157766309011-1-1.html OBS能否给桶设置允许上传文件的类型 https://bbs.huaweicloud.com/forum/thread-0220151925139468006-1-1.html OBS 能否对上传的图片自动生成加水印的图片?代码怎么写 https://bbs.huaweicloud.com/forum/thread-0269151292821745010-1-1.html OBS官网案例-大数据分析这个场景里,OBS用在哪个地方?图上没有标出来 https://bbs.huaweicloud.com/forum/thread-02109151292749308013-1-1.html OBS支持上传哪些类型的文件 https://bbs.huaweicloud.com/forum/thread-02120151292618183012-1-1.html OBS怎么查看哪些是用户上传了一半然后中断的文件,并定时清理这些无效文件 https://bbs.huaweicloud.com/forum/thread-0272151292413155011-1-1.html OBS上传一个文件,默认会生成几个副本来保证安全? https://bbs.huaweicloud.com/forum/thread-0269151292358910008-1-1.html Android studio 采用流式方法下载程序崩溃(Java) https://bbs.huaweicloud.com/forum/thread-02120151241432258011-1-1.html 华为云obs怎么实现取消下载 https://bbs.huaweicloud.com/forum/thread-0282150688236887024-1-1.html JavaSDK上传文本数据到OBS问题 https://bbs.huaweicloud.com/forum/thread-02127150604424860031-1-1.html 华为云OBS不支持自己的鸿蒙NextOS的ArkTs语言版本 https://bbs.huaweicloud.com/forum/thread-0226150461518739031-1-1.html
-
在我看来,不就是Restful http 协议吗,为啥C语言不支持,而其他语言都能支持?
-
-
OBS怎么给桶分配权限
上滑加载中
推荐直播
-
华为云码道Agent集成与鸿蒙实战2026/08/11 周二 19:00-21:00
王一男-华为云码道产品规划专家;李炎-华为云码道产品专家;彭江敏-华为云鸿蒙端云一体化开发专家
本次直播带你解读华为云码道7月份产品新特性、新功能。更有专家演示码道Agent Space × 钉钉机器集成实战,从0到1打通消息通道;码道鸿蒙端云一体化实战,快速搭建员工签到系统。
回顾中 -
华为云开发者AI素养直播课·第五期2026/09/04 周五 16:00-18:00
林华鼎-华为云AI开发者运营负责人;蒋春阳-华为云AI开发者案例开发专家
本期直播内容: AI工具体验营 · 第5-8课连讲。Agent-Team 多智能体协作完成毕业设计实践
回顾中 -
华为云开发者AI素养ClassRoom·第六期2026/09/08 周二 19:00-20:00
樊渊-2026华为软件挑战赛冠军
高手来了:看软挑高手解析二维排样问题—从工业难题到算法突破
回顾中
热门标签