@yuntools/ali-oss
Version:
阿里云 OSS 命令行工具 ossutil 封装,支持 ESM,CJS 导入,提供 TypeScript 类型定义
117 lines • 4.76 kB
TypeScript
import { DataDownload } from './method/download.js';
import { CpOptions, DataCp, DataSign, DataStat, DownloadOptions, LinkOptions, MkdirOptions, MvOptions, ProbUpOptions, RmOptions, RmrfOptions, SignOptions, StatOptions, SyncLocalOptions, SyncRemoteOptions, UploadOptions } from './method/index.js';
import { SyncCloudOptions } from './method/sync.js';
import { Config, DataBase, ProcessRet } from './types.js';
/**
* 阿里云 OSS 服务接口,
* 基于命令行工具 ossutil 封装
*/
export declare class OssClient {
/**
* 配置参数或者配置文件路径
* @default ~/.ossutilconfig
*/
protected readonly configInput?: string | Config | undefined;
cmd: string;
debug: boolean;
configPath: string;
private readonly config;
constructor(
/**
* 配置参数或者配置文件路径
* @default ~/.ossutilconfig
*/
configInput?: string | Config | undefined, cmd?: string);
/**
* 删除 OSS 配置文件
*/
destroy(): Promise<void>;
/**
* 在远程之间拷贝文件。
* 若 force 为空或者 false,且目标文件存在时会卡在命令行提示输入阶段(无显示)最后导致超时异常
* @note 下载文件使用 `download()`
* @link https://help.aliyun.com/document_detail/120057.html
*/
cp(options: CpOptions): Promise<ProcessRet<DataCp>>;
/**
* 创建软链接
* @link https://help.aliyun.com/document_detail/120059.html
*/
createSymlink(options: LinkOptions): Promise<ProcessRet>;
/**
* 下载远程文件到本地
* 若 force 为空或者 false,且目标文件存在时会卡在命令行提示输入阶段(无显示)最后导致超时异常
* @link https://help.aliyun.com/document_detail/120057.html
*/
download(options: DownloadOptions): Promise<ProcessRet<DataDownload>>;
/**
* 创建目录
* @link https://help.aliyun.com/document_detail/120062.html
*/
mkdir(options: MkdirOptions): Promise<ProcessRet>;
/**
* 移动云端的 OSS 对象
* 流程为先 `cp()` 然后 `rm()`
*/
mv(options: MvOptions): Promise<ProcessRet<DataStat | DataBase>>;
/**
* OSS 远程路径是否存在
*/
pathExists(options: StatOptions): Promise<boolean>;
/**
* 探测上传状态
* @link https://help.aliyun.com/document_detail/120061.html
*/
probeUpload(options: ProbUpOptions): Promise<ProcessRet>;
/**
* 删除云对象,不支持删除 bucket 本身
* 如果在 recusive 为 false 时删除目录,则目录参数值必须以 '/' 结尾,否则不会删除成功
* @link https://help.aliyun.com/document_detail/120053.html
*/
rm(options: RmOptions): Promise<ProcessRet>;
/**
* 递归删除,相当于 `rm -rf`
* @link https://help.aliyun.com/document_detail/120053.html
*/
rmrf(options: RmrfOptions): Promise<ProcessRet>;
/**
* sign(生成签名URL)
* @link https://help.aliyun.com/document_detail/120064.html
*/
sign(options: SignOptions): Promise<ProcessRet<DataSign>>;
/**
* 查看 Bucket 和 Object 信息
* @link https://help.aliyun.com/document_detail/120054.html
*/
stat(options: StatOptions): Promise<ProcessRet<DataStat>>;
/**
* 在 OSS 之间同步文件
* - force 参数默认 true
* - 若 force 为 false,且目标文件存在时会卡在命令行提示输入阶段(无显示)最后导致超时异常
* @link https://help.aliyun.com/document_detail/256354.html
*/
syncCloud(options: SyncCloudOptions): Promise<ProcessRet<DataCp>>;
/**
* 同步 OSS 文件到本地
* - force 参数默认 true
* - 若 force 为 false,且目标文件存在时会卡在命令行提示输入阶段(无显示)最后导致超时异常
* @link https://help.aliyun.com/document_detail/256352.html
*/
syncLocal(options: SyncLocalOptions): Promise<ProcessRet<DataCp>>;
/**
* 同步本地文件到 OSS
* - force 参数默认 true
* - 若 force 为 false,且目标文件存在时会卡在命令行提示输入阶段(无显示)最后导致超时异常
* @link https://help.aliyun.com/document_detail/193394.html
*/
syncRemote(options: SyncRemoteOptions): Promise<ProcessRet<DataCp>>;
/**
* 上传本地文件到 OSS
* 若 force 为空或者 false,且目标文件存在时会卡在命令行提示输入阶段(无显示)最后导致超时异常
* @link https://help.aliyun.com/document_detail/120057.html
*/
upload(options: UploadOptions): Promise<ProcessRet<DataCp>>;
private runner;
private genCliParams;
}
//# sourceMappingURL=oss.d.ts.map