java获取对象存储oss的bucket容量使用情况

一、前言

1.阿里云的对象存储oss的java api中没有直接获取bucket容量使用情况的接口,度娘N久之后整理出一种间接统计方法:即递归获取根目录下所有文件大小,相加后得出已用容量。
2.网上还有一种方法:通过OSS监控服务获取使用情况,有兴趣的朋友可以试试,
地址链接:https://developer.aliyun.com/ask/2278

二、正文

1.引入maven依赖

<dependency>
    <groupId>com.aliyun.oss</groupId>
    <artifactId>aliyun-sdk-oss</artifactId>
    <version>2.8.2</version>
</dependency>

2.示例代码

package com.hzjp.dev.util;

import com.aliyun.oss.OSS;
import com.aliyun.oss.OSSClient;
import com.aliyun.oss.model.*;
import com.aliyuncs.DefaultAcsClient;
import com.aliyuncs.IAcsClient;
import com.aliyuncs.arms.model.v20190808.QueryMetricRequest;
import com.aliyuncs.arms.model.v20190808.QueryMetricResponse;
import com.aliyuncs.exceptions.ClientException;
import com.aliyuncs.exceptions.ServerException;
import com.aliyuncs.profile.DefaultProfile;
import com.google.gson.Gson;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang.exception.ExceptionUtils;
import java.io.InputStream;
import java.util.*;

/**
 * Created by Administrator on 2018/5/9.
 */
@Slf4j
public class OssUtils {


    private static String ENDPOINT = "your oss point";
    private static String ACCESSKEYID = "your accesskeyid";
    private static String ACCESSKEYSECRET = "your accesskeysecret";
    private static String NEW_BUCKET = "your bucket name";

    private static OSSClient client = null;


    /** 创建OSSClient实例
     *
     * @return
     */
    private static OSSClient getOssClient(){
        client = new OSSClient(ENDPOINT, ACCESSKEYID, ACCESSKEYSECRET);
        return client;
    }

    /** 关闭OSSClient
     *
     */
    private static void close(){
        OssUtils.getOssClient().shutdown();
    }


    /**
     * 获取根目录下所有文件大小
     * @param bucketName
     * @return
     */
    public static Long getOss(String bucketName){
        try {
            if (StringUtils.isBlank(bucketName)) {
                bucketName = NEW_BUCKET;
            }
            long sizeTotal = 0L;
            ObjectListing objectListing = null;
            do {
                // 列举bucket所有文件或目录,每次1000个
                ListObjectsRequest request = new ListObjectsRequest(bucketName).withDelimiter("/").withMaxKeys(1000);
                // 列举bucket的指定目录(yourPrefix)下文件,每次1000个
                // ListObjectsRequest request = new ListObjectsRequest(bucketName).withMaxKeys(1000).withPrefix("yourPrefix");

                if (objectListing != null) {
                    request.setMarker(objectListing.getNextMarker());
                }
                objectListing = OssUtils.getOssClient().listObjects(request);
                //获取当前文件夹下所有子目录大小
                List<String> folders = objectListing.getCommonPrefixes();
                for (String folder : folders) {
                    sizeTotal = calculateFolderLength(OssUtils.getOssClient(), bucketName, folder)+sizeTotal;
                }

                //获取当前文件夹下所有文件大小
                List<OSSObjectSummary> sums = objectListing.getObjectSummaries();
                if (sums.size()==0){
                    continue;
                }
                for (OSSObjectSummary s : sums) {
                    sizeTotal = sizeTotal+s.getSize();
                }

            } while (objectListing.isTruncated());
            //转换为TB
            sizeTotal = sizeTotal/1024/1024/1024/1024;
            log.info(" 文件夹下所有子目录大小 : [{}] TB",sizeTotal);
            return sizeTotal;
        }catch (Exception e){
            e.printStackTrace();
            return 0L;
        }finally {
            OssUtils.close();
        }

    }

    private static long calculateFolderLength(OSS ossClient, String bucketName, String folder) {
        long size = 0L;
        ObjectListing objectListing = null;
        do {
            // MaxKey默认值为100,最大值为1000。
            ListObjectsRequest request = new ListObjectsRequest(bucketName).withPrefix(folder).withMaxKeys(1000);
            if (objectListing != null) {
                request.setMarker(objectListing.getNextMarker());
            }
            objectListing = ossClient.listObjects(request);
            List<OSSObjectSummary> sums = objectListing.getObjectSummaries();
            for (OSSObjectSummary s : sums) {
                size += s.getSize();
            }
        } while (objectListing.isTruncated());
        return size;
    }
}
阿⾥云 对象存储 SDK ⽰例 ⽂档版本:20190920 对象存储 SDK ⽰例 ⽂档版本:20190920 I 法律声明....................................................................................I 通⽤约定....................................................................................I 1 SDK ⽂档简介.........................................................................1 2 Java......................................................................................2 2.1 前⾔............................................................................................................2 2.2 安装............................................................................................................3 2.3 快速⼊⻔......................................................................................................4 2.4 初始化.........................................................................................................8 2.5 存储空间....................................................................................................12 2.6 请求者付费模式...........................................................................................17 2.7 单链接限速.................................................................................................19 2.8 存储空间标签..............................................................................................21 2.9 对象标签....................................................................................................23 2.9.1 设置对象标签...................................................................................23 2.9.2 获取对象标签...................................................................................32 2.9.3 删除对象标签...................................................................................32 2.9.4 对象标签和⽣命周期管理....................................................................33 2.10 服务器端加密............................................................................................ 35 2.11 上传⽂件.................................................................................................. 37 2.11.1 概述.............................................................................................38 2.11.2 简单上传.......................................................................................38 2.11.3 表单上传.......................................................................................40 2.11.4 追加上传.......................................................................................44 2.11.5 断点续传上传.................................................................................45 2.11.6 分⽚上传.......................................................................................46 2.11.7 进度条..........................................................................................54 2.11.8 上传回调.......................................................................................55 2.12 下载⽂件.................................................................................................. 56 2.12.1 概述.............................................................................................56 2.12.2 流式下载.......................................................................................57 2.12.3 下载到本地⽂件..............................................................................58 2.12.4 范围下载.......................................................................................58 2.12.5 断点续传下载.................................................................................59 2.12.6 限定条件下载.................................................................................61 2.12.7 进度条..........................................................................................62 2.13 管理⽂件.................................................................................................. 63 2.13.1 概述.............................................................................................63 2.13.2 判断⽂件是否存在...........................................................................64 2.13.3 管理⽂件访问权限...........................................................................64 2.13.4 管理⽂件元信息..............................................................................66 II ⽂档版本:20190920 对象存储 SDK ⽰例 / ⽬录 2.13.5 转换⽂件存储类型...........................................................................69 2.13.6 列举⽂件.......................................................................................71 2.13.7 查询⽂件.......................................................................................81 2.13.8 删除⽂件.......................................................................................83 2.13.9 拷⻉⽂件.......................................................................................85 2.13.10 解冻归档⽂件............................................................................... 89 2.13.11 管理软链接.................................................................................. 90 2.14 数据安全性............................................................................................... 92 2.15 授权访问.................................................................................................. 94 2.16 ⽣命周期.................................................................................................. 98 2.17 跨域资源共享.......................................................................................... 101 2.18 访问⽇志................................................................................................ 103 2.19 静态⽹站托管.......................................................................................... 105 2.20 防盗链................................................................................................... 106 2.21 跨区域复制............................................................................................. 108 2.22 图⽚处理................................................................................................ 110 2.23 异常处理................................................................................................ 117 2.24 常⻅问题................................................................................................ 119 3 Python..............................................................................133 3.1 前⾔........................................................................................................133 3.2 安装........................................................................................................134 3.3 快速⼊⻔.................................................................................................. 137 3.4 初始化..................................................................................................... 139 3.5 存储空间.................................................................................................. 141 3.6 请求者付费模式......................................................................................... 144 3.7 单链接限速............................................................................................... 145 3.8 存储空间标签............................................................................................ 147 3.9 对象标签.................................................................................................. 149 3.9.1 设置对象标签.................................................................................149 3.9.2 获取对象标签.................................................................................156 3.9.3 删除对象标签.................................................................................156 3.9.4 对象标签和⽣命周期管理..................................................................157 3.10 上传⽂件................................................................................................ 159 3.10.1 概述...........................................................................................159 3.10.2 简单上传..................................................................................... 159 3.10.3 追加上传..................................................................................... 162 3.10.4 断点续传上传............................................................................... 162 3.10.5 分⽚上传..................................................................................... 163 3.10.6 进度条........................................................................................ 165 3.10.7 上传回调..................................................................................... 165 3.11 下载⽂件................................................................................................ 166 3.11.1 概述...........................................................................................166 3.11.2 流式下载..................................................................................... 167 3.11.3 下载到本地⽂件............................................................................ 167 3.11.4 范围下载..................................................................................... 168 ⽂档版本:20190920 III 对象存储 SDK ⽰例 / ⽬录 3.11.5 断点续传下载............................................................................... 168 3.11.6 进度条........................................................................................ 170 3.12 管理⽂件................................................................................................ 170 3.12.1 概述...........................................................................................170 3.12.2 判断⽂件是否存在......................................................................... 171 3.12.3 管理⽂件访问权限......................................................................... 171 3.12.4 管理⽂件元信息............................................................................ 172 3.12.5 转换⽂件存储类型......................................................................... 174 3.12.6 列举⽂件..................................................................................... 176 3.12.7 查询⽂件..................................................................................... 177 3.12.8 删除⽂件..................................................................................... 182 3.12.9 拷⻉⽂件..................................................................................... 183 3.12.10 解冻归档⽂件............................................................................. 185 3.12.11 管理软链接................................................................................ 185 3.13 授权访问................................................................................................ 186 3.14 开启Python SDK⽇志.............................................................................. 188 3.15 数据加密................................................................................................ 189 3.15.1 客⼾端加密.................................................................................. 189 3.15.2 服务器端加密............................................................................... 192 3.16 静态⽹站托管.......................................................................................... 194 3.17 ⽣命周期................................................................................................ 195 3.18 跨域资源共享.......................................................................................... 198 3.19 访问⽇志................................................................................................ 199 3.20 防盗链................................................................................................... 200 3.21 图⽚处理................................................................................................ 202 3.22 中⽂和时间............................................................................................. 209 3.23 异常处理................................................................................................ 211 3.24 常⻅问题................................................................................................ 213 4 Go.....................................................................................216 4.1 前⾔........................................................................................................216 4.2 安装........................................................................................................217 4.3 快速⼊⻔.................................................................................................. 218 4.4 初始化..................................................................................................... 221 4.5 存储空间.................................................................................................. 223 4.6 请求者付费模式......................................................................................... 230 4.7 单链接限速............................................................................................... 233 4.8 存储空间标签............................................................................................ 237 4.9 对象标签.................................................................................................. 240 4.9.1 设置对象标签.................................................................................240 4.9.2 获取对象标签.................................................................................248 4.9.3 删除对象标签.................................................................................249 4.9.4 对象标签和⽣命周期管理..................................................................250 4.10 服务器端加密.......................................................................................... 251 4.11 上传⽂件................................................................................................ 254 4.11.1 概述...........................................................................................254 IV ⽂档版本:20190920 对象存储 SDK ⽰例 / ⽬录 4.11.2 简单上传..................................................................................... 254 4.11.3 追加上传..................................................................................... 257 4.11.4 断点续传上传............................................................................... 258 4.11.5 分⽚上传..................................................................................... 260 4.11.6 进度条........................................................................................ 265 4.12 下载⽂件................................................................................................ 266 4.12.1 概述...........................................................................................266 4.12.2 流式下载..................................................................................... 267 4.12.3 范围下载..................................................................................... 269 4.12.4 下载到本地⽂件............................................................................ 270 4.12.5 断点续传下载............................................................................... 271 4.12.6 限定条件下载............................................................................... 272 4.12.7 ⽂件压缩下载............................................................................... 274 4.12.8 进度条........................................................................................ 274 4.13 管理⽂件................................................................................................ 275 4.13.1 概述...........................................................................................276 4.13.2 判断⽂件是否存在......................................................................... 276 4.13.3 管理⽂件访问权限......................................................................... 277 4.13.4 管理⽂件元信息............................................................................ 278 4.13.5 转换⽂件存储类型......................................................................... 281 4.13.6 列举⽂件..................................................................................... 283 4.13.7 删除⽂件..................................................................................... 289 4.13.8 拷⻉⽂件..................................................................................... 291 4.13.9 解冻归档⽂件............................................................................... 295 4.13.10 管理软链接................................................................................ 297 4.14 授权访问................................................................................................ 299 4.15 ⽣命周期................................................................................................ 302 4.16 访问⽇志................................................................................................ 304 4.17 静态⽹站托管.......................................................................................... 306 4.18 防盗链................................................................................................... 307 4.19 跨域资源共享.......................................................................................... 309 4.20 图⽚处理................................................................................................ 311 4.21 错误处理................................................................................................ 319 5 C++................................................................................... 323 5.1 前⾔........................................................................................................323 5.2 安装........................................................................................................324 5.3 快速⼊⻔.................................................................................................. 326 5.4 初始化..................................................................................................... 330 5.5 存储空间.................................................................................................. 334 5.6 请求者付费模式......................................................................................... 340 5.7 单链接限速............................................................................................... 343 5.8 对象标签.................................................................................................. 344 5.8.1 设置对象标签.................................................................................345 5.8.2 获取对象标签.................................................................................354 5.8.3 删除对象标签.................................................................................355 ⽂档版本:20190920 V 对象存储 SDK ⽰例 / ⽬录 5.8.4 对象标签和⽣命周期管理..................................................................356 5.9 上传⽂件.................................................................................................. 358 5.9.1 概述.............................................................................................358 5.9.2 简单上传.......................................................................................359 5.9.3 追加上传.......................................................................................360 5.9.4 断点续传上传.................................................................................361 5.9.5 分⽚上传.......................................................................................363 5.9.6 中断上传.......................................................................................370 5.9.7 进度条..........................................................................................371 5.9.8 上传回调.......................................................................................372 5.10 下载⽂件................................................................................................ 373 5.10.1 概述...........................................................................................373 5.10.2 下载到本地⽂件............................................................................ 373 5.10.3 下载到本地内存............................................................................ 374 5.10.4 范围下载..................................................................................... 375 5.10.5 断点续传下载............................................................................... 376 5.10.6 进度条........................................................................................ 378 5.11 管理⽂件................................................................................................ 379 5.11.1 概述...........................................................................................379 5.11.2 管理⽂件访问权限......................................................................... 379 5.11.3 管理⽂件元信息............................................................................ 381 5.11.4 转换⽂件存储类型......................................................................... 383 5.11.5 列举⽂件..................................................................................... 386 5.11.6 删除⽂件....................................................................................392 5.11.7 拷⻉⽂件..................................................................................... 393 5.11.8 判断⽂件是否存在......................................................................... 396 5.11.9 解冻归档⽂件............................................................................... 397 5.11.10 管理软链接................................................................................ 399 5.12 授权访问................................................................................................ 401 5.13 ⽣命周期................................................................................................ 404 5.14 跨域资源共享.......................................................................................... 407 5.15 访问⽇志................................................................................................ 409 5.16 静态⽹站托管.......................................................................................... 412 5.17 防盗链................................................................................................... 414 5.18 图⽚处理................................................................................................ 417 6 PHP.................................................................................. 424 6.1 前⾔........................................................................................................424 6.2 安装........................................................................................................424 6.3 快速⼊⻔.................................................................................................. 426 6.4 初始化..................................................................................................... 430 6.5 存储空间.................................................................................................. 433 6.6 上传⽂件.................................................................................................. 439 6.6.1 概述.............................................................................................439 6.6.2 简单上传.......................................................................................439 6.6.3 追加上传.......................................................................................440 VI ⽂档版本:20190920 对象存储 SDK ⽰例 / ⽬录 6.6.4 分⽚上传.......................................................................................442 6.6.5 上传回调.......................................................................................449 6.7 下载⽂件.................................................................................................. 452 6.7.1 概述.............................................................................................452 6.7.2 下载到本地⽂件..............................................................................452 6.7.3 下载到本地内存..............................................................................453 6.7.4 范围下载.......................................................................................454 6.7.5 限定条件下载.................................................................................454 6.8 管理⽂件.................................................................................................. 456 6.8.1 概述.............................................................................................456 6.8.2 判断⽂件是否存在...........................................................................456 6.8.3 管理⽂件访问权限...........................................................................457 6.8.4 管理⽂件元信息..............................................................................459 6.8.5 列举⽂件.......................................................................................461 6.8.6 删除⽂件.......................................................................................463 6.8.7 拷⻉⽂件.......................................................................................465 6.8.8 解冻归档⽂件.................................................................................467 6.8.9 管理软链接....................................................................................468 6.8.10 开启MD5校验..............................................................................469 6.9 授权访问.................................................................................................. 470 6.10 静态⽹站托管.......................................................................................... 473 6.11 ⽣命周期................................................................................................ 475 6.12 访问⽇志................................................................................................ 477 6.13 跨域资源共享.......................................................................................... 480 6.14 防盗链................................................................................................... 482 6.15 ⾃定义域名绑定....................................................................................... 484 6.16 图⽚处理................................................................................................ 486 6.17 异常处理................................................................................................ 492 7 C.......................................................................................495 7.1 前⾔........................................................................................................495 7.2 安装........................................................................................................496 7.3 快速⼊⻔.................................................................................................. 500 7.4 初始化..................................................................................................... 506 7.5 存储空间.................................................................................................. 509 7.6 上传⽂件.................................................................................................. 518 7.6.1 概述.............................................................................................518 7.6.2 简单上传.......................................................................................518 7.6.3 追加上传.......................................................................................522 7.6.4 断点续传上传.................................................................................525 7.6.5 分⽚上传.......................................................................................527 7.6.6 进度条..........................................................................................531 7.6.7 上传回调.......................................................................................532 7.7 下载⽂件.................................................................................................. 534 7.7.1 概述.............................................................................................534 7.7.2 下载到本地⽂件..............................................................................535 ⽂档版本:20190920 VII 对象存储 SDK ⽰例 / ⽬录 7.7.3 下载到本地内存..............................................................................536 7.7.4 范围下载.......................................................................................537 7.7.5 断点续传下载.................................................................................539 7.7.6 进度条..........................................................................................540 7.8 管理⽂件.................................................................................................. 542 7.8.1 概述.............................................................................................542 7.8.2 管理⽂件访问权限...........................................................................542 7.8.3 管理⽂件元信息..............................................................................544 7.8.4 列举⽂件.......................................................................................546 7.8.5 删除⽂件.......................................................................................552 7.8.6 拷⻉⽂件.......................................................................................556 7.8.7 解冻归档⽂件.................................................................................560 7.8.8 管理软链接....................................................................................562 7.9 授权访问.................................................................................................. 564 7.10 ⽣命周期................................................................................................ 569 7.11 图⽚处理................................................................................................ 573 7.12 跨域资源共享.......................................................................................... 582 7.13 访问⽇志................................................................................................ 586 7.14 防盗链................................................................................................... 589 7.15 静态⽹站托管.......................................................................................... 593 7.16 错误处理................................................................................................ 596 7.17 常⻅问题................................................................................................ 598 8 .NET................................................................................. 599 8.1 前⾔........................................................................................................599 8.2 安装........................................................................................................600 8.3 快速⼊⻔.................................................................................................. 602 8.4 初始化..................................................................................................... 605 8.5 存储空间.................................................................................................. 607 8.6 上传⽂件.................................................................................................. 611 8.6.1 概述.............................................................................................611 8.6.2 简单上传.......................................................................................611 8.6.3 追加上传.......................................................................................615 8.6.4 断点续传上传.................................................................................616 8.6.5 分⽚上传.......................................................................................617 8.6.6 进度条..........................................................................................623 8.6.7 上传回调.......................................................................................624 8.7 下载⽂件.................................................................................................. 626 8.7.1 概述.............................................................................................626 8.7.2 流式下载.......................................................................................626 8.7.3 范围下载.......................................................................................627 8.7.4 断点续传下载.................................................................................628 8.7.5 进度条..........................................................................................629 8.8 管理⽂件.................................................................................................. 630 8.8.1 概述.............................................................................................630 8.8.2 判断⽂件是否存在...........................................................................630 VIII ⽂档版本:20190920 对象存储 SDK ⽰例 / ⽬录 8.8.3 管理⽂件访问权限...........................................................................631 8.8.4 管理⽂件元信息..............................................................................632 8.8.5 列举⽂件.......................................................................................634 8.8.6 删除⽂件.......................................................................................638 8.8.7 拷⻉⽂件.......................................................................................640 8.8.8 解冻归档⽂件.................................................................................643 8.8.9 管理软链接....................................................................................645 8.9 授权访问.................................................................................................. 645 8.10 ⽣命周期................................................................................................ 648 8.11 访问⽇志................................................................................................ 650 8.12 跨域资源共享.......................................................................................... 652 8.13 静态⽹站托管.......................................................................................... 654 8.14 防盗链................................................................................................... 656 8.15 图⽚处理................................................................................................ 658 8.16 异常处理................................................................................................ 665 9 Android............................................................................ 668 9.1 前⾔........................................................................................................668 9.2 安装........................................................................................................668 9.3 快速⼊⻔.................................................................................................. 670 9.4 初始化..................................................................................................... 675 9.5 存储空间.................................................................................................. 678 9.6 上传⽂件.................................................................................................. 681 9.6.1 概述.............................................................................................681 9.6.2 简单上传.......................................................................................682 9.6.3 追加上传.......................................................................................684 9.6.4 分⽚上传.......................................................................................685 9.6.5 断点续传上传.................................................................................688 9.6.6 进度条..........................................................................................691 9.6.7 上传回调.......................................................................................692 9.7 下载⽂件.................................................................................................. 693 9.7.1 概述.............................................................................................693 9.7.2 流式下载.......................................................................................693 9.7.3 范围下载.......................................................................................695 9.7.4 下载到本地⽂件..............................................................................696 9.7.5 限定条件下载.................................................................................697 9.7.6 断点续传下载.................................................................................698 9.8 管理⽂件.................................................................................................. 699 9.8.1 概述.............................................................................................699 9.8.2 判断⽂件是否存在...........................................................................700 9.8.3 拷⻉⽂件.......................................................................................700 9.8.4 列举⽂件.......................................................................................701 9.8.5 删除⽂件.......................................................................................703 9.8.6 设置Content-Type.........................................................................704 9.8.7 获取⽂件元信息..............................................................................704 9.8.8 解冻归档⽂件................................................................................705 ⽂档版本:20190920 IX 对象存储 SDK ⽰例 / ⽬录 9.8.9 管理软链接...................................................................................706 9.9 数据安全性............................................................................................... 707 9.10 ⽣命周期................................................................................................ 708 9.11 防盗链................................................................................................... 710 9.12 签名URL................................................................................................713 9.13 授权访问................................................................................................ 713 9.14 访问⽇志................................................................................................ 717 9.15 图⽚处理................................................................................................ 719 9.16 异常响应................................................................................................ 721 10 iOS..................................................................................723 10.1 前⾔...................................................................................................... 723 10.2 安装...................................................................................................... 723 10.3 快速⼊⻔................................................................................................ 725 10.4 初始化................................................................................................... 728 10.5 存储空间................................................................................................ 731 10.6 上传⽂件................................................................................................ 733 10.6.1 概述...........................................................................................733 10.6.2 简单上传..................................................................................... 734 10.6.3 分⽚上传..................................................................................... 735 10.6.4 追加上传..................................................................................... 739 10.6.5 断点续传上传............................................................................... 740 10.6.6 上传回调..................................................................................... 742 10.7 下载⽂件................................................................................................ 742 10.7.1 概述...........................................................................................742 10.7.2 简单下载..................................................................................... 743 10.7.3 流式下载..................................................................................... 743 10.7.4 范围下载..................................................................................... 744 10.7.5 断点续传下载............................................................................... 745 10.8 管理⽂件................................................................................................ 754 10.8.1 概述...........................................................................................754 10.8.2 判断⽂件是否存在......................................................................... 754 10.8.3 获取⽂件元信息............................................................................ 755 10.8.4 列举⽂件..................................................................................... 755 10.8.5 拷⻉⽂件..................................................................................... 756 10.8.6 删除⽂件..................................................................................... 757 10.9 数据安全性............................................................................................. 757 10.10 签名URL..............................................................................................759 10.11 授权访问...............................................................................................760 10.12 图⽚处理...............................................................................................764 10.13 异常响应...............................................................................................766 11 Node.js............................................................................767 11.1 安装...................................................................................................... 767 11.2 配置项................................................................................................... 768 11.3 快速⼊⻔................................................................................................ 769 X ⽂档版本:20190920 对象存储 SDK ⽰例 / ⽬录 11.4 初始化................................................................................................... 771 11.5 存储空间................................................................................................ 772 11.6 上传⽂件................................................................................................ 774 11.6.1 概述...........................................................................................774 11.6.2 上传本地⽂件............................................................................... 775 11.6.3 上传本地内存............................................................................... 775 11.6.4 流式上传..................................................................................... 776 11.6.5 分⽚上传..................................................................................... 777 11.6.6 追加上传..................................................................................... 779 11.6.7 断点续传上传............................................................................... 780 11.7 下载⽂件................................................................................................ 781 11.7.1 概述...........................................................................................781 11.7.2 下载到本地⽂件............................................................................ 781 11.7.3 下载到本地内存............................................................................ 782 11.7.4 流式下载..................................................................................... 782 11.7.5 HTTP 下载................................................................................. 783 11.8 管理⽂件................................................................................................ 783 11.8.1 概述...........................................................................................783 11.8.2 判断⽂件是否存在......................................................................... 784 11.8.3 管理⽂件元信息............................................................................ 784 11.8.4 列举指定Bucket下的所有⽂件.........................................................785 11.8.5 列举指定⽬录下的⽂件和⼦⽬录....................................................... 786 11.8.6 拷⻉⽂件..................................................................................... 787 11.8.7 删除⽂件..................................................................................... 788 11.8.8 解冻归档⽂件............................................................................... 789 11.9 ⾃定义域名绑定....................................................................................... 790 11.10 授权访问...............................................................................................790 11.11 访问权限...............................................................................................793 11.12 ⽣命周期...............................................................................................795 11.13 访问⽇志...............................................................................................796 11.14 静态⽹站托管.........................................................................................798 11.15 防盗链..................................................................................................799 11.16 图⽚处理...............................................................................................801 11.17 异常处理...............................................................................................806 11.18 常⻅问题...............................................................................................807 12 Browser.js....................................................................... 809 12.1 安装...................................................................................................... 809 12.2 快速开始................................................................................................ 812 12.3 配置项................................................................................................... 818 12.4 上传⽂件................................................................................................ 819 12.5 下载⽂件................................................................................................ 824 12.6 管理⽂件................................................................................................ 825 12.7 ⾃定义域名绑定....................................................................................... 829 12.8 授权访问................................................................................................ 830 12.9 访问权限................................................................................................ 832 ⽂档版本:20190920 XI 对象存储 SDK ⽰例 / ⽬录 12.10 图⽚处理...............................................................................................833 12.11 浏览器应⽤............................................................................................839 12.12 异常处理...............................................................................................843 12.13 常⻅问题...............................................................................................843 12.14 ⽇志收集...............................................................................................847 13 Ruby............................................................................... 848 13.1 安装...................................................................................................... 848 13.2 快速⼊⻔................................................................................................ 851 13.3 存储空间................................................................................................ 854 13.4 上传⽂件................................................................................................ 856 13.5 下载⽂件................................................................................................ 860 13.6 管理⽂件................................................................................................ 862 13.7 ⾃定义域名绑定....................................................................................... 866 13.8 使⽤STS进⾏临时授权...............................................................................867 13.9 访问权限................................................................................................ 868 13.10 ⽣命周期...............................................................................................870 13.11 访问⽇志...............................................................................................871 13.12 静态⽹站托管.........................................................................................872 13.13 防盗链..................................................................................................873 13.14 跨域资源共享.........................................................................................874 13.15 异常处理...............................................................................................875 13.16 Rails应⽤............................................................................................. 876 14 Media-C...........................................................................884 14.1 前⾔...................................................................................................... 884 14.2 安装...................................................................................................... 885 14.3 初始化................................................................................................... 887 14.4 客⼾端................................................................................................... 888 14.5 服务端................................................................................................... 895 14.6 HLS基础接口.......................................................................................... 904 14.7 HLS封装接口.......................................................................................... 909 14.8 使⽤场景................................................................................................ 912 14.9 常⻅问题................................................................................................ 915 15 conref............................................................................. 917
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值