upyun-js

1.0.5 • Public • Published

upyun-js 是对 又拍云 js sdk 的二次封装。

languuage npm package NPM downloads license

简体中文 | English

✨ 特性

  • 提供更为友好的接口
  • 新增对目录的 CRUD 操作

📦 安装

npm install upyun-js

🔨 接口

初始化

const Upyun = require('upyun-js');
const config = {
  serviceName: 'upyun service',
  operatorName: 'upyun operator',
  operatorPassword: 'upyun password'
};
 
const upyun = new Upyun(config);

下载文件 upyun.downloadFile

/**
  * @param {String} remotePath // 远程文件路径
  * @param {String} localPath // 本地文件夹
  * @return {Promise} 
  */
upyun.downloadFile(remotePath, localPath);

下载文件夹 upyun.downloadDir

/**
 * @param {String} remotePath: 远程文件夹
 * @param {String} localPath: 本地文件夹
 * @return {Promise} 
*/
upyun.downloadDir(remotePath, localPath);

上传文件 upyun.uploadFile

/**
 * @param {String} remotePath: 远程文件夹
 * @param {String} localFile: 本地文件
 * @return {Promise} 
*/
upyun.uploadFile(remotePath, localFile, opts);

上传文件夹 upyun.uploadDir

/**
 * @param {String} remotePath: 远程文件夹
 * @param {String} localPath: 本地文件夹
 * @return {Promise} 
*/
upyun.uploadDir(remotePath, localPath);

删除文件 upyun.rmfile

/**
 * @param {String} remoteFile: 远程文件
 * @return {Boolean} 
*/
upyun.rmfile(remoteFile);

删除文件夹 upyun.rmdir

/**
 * @param {String} dirname: 远程文件夹
 * @return {Boolean} 
*/
upyun.rmdir(dirname);

创建文件夹 upyun.mkdir

/**
 * @param {String} remotePath: 远程路径
 * @return {Any} 
*/
upyun.mkdir(remotePath);

缓存刷新 upyun.refresh

/**
 * @param {Array<String>} urls: 待刷新的远程文件数组
 * @return {Promise} 
*/
upyun.refresh(urls);

获取文件基本信息 upyun.getFileMeta

/**
 * @param {String} remotePath: 远程文件
 * @return {Promise} 
*/
upyun.getFileMeta(remotePath);

查看目录大小 upyun.usage

/**
 * @param {String} remotePath: 远程目录
 * @return {Promise} 
*/
upyun.usage(remotePath);

获取目录下的文件列表 upyun.listDir

/**
 * @param {String} remotePath: 远程目录
 * @param {Object} opts: 获取列表数据可选的 limit、order 或 iter 值
 * @return {Promise} 
*/
upyun.listDir(remotePath, opts);

🐤 相关

upyun js sdk

upyun-webpack-plugin

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 1.0.5
    1
    • latest

Version History

Package Sidebar

Install

npm i upyun-js

Weekly Downloads

1

Version

1.0.5

License

Anti 996

Unpacked Size

2.64 MB

Total Files

24

Last publish

Collaborators

  • terenyeung