Skip to content

Latest commit

 

History

History
162 lines (123 loc) · 3.09 KB

README-en.md

File metadata and controls

162 lines (123 loc) · 3.09 KB

upyun-js is secondary encapsulation for upyun js sdk.

languuage npm package NPM downloads license

简体中文 | English

✨ Features

  • Support more friendly interface
  • addition to CRUD for directory

📦 Install

npm install upyun-js

🔨 Interfaces

Initialization

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

const upyun = new Upyun(config);

Download file: upyun.downloadFile

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

Download directory: upyun.downloadDir

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

Upload file: upyun.uploadFile

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

Upload direactory: upyun.uploadDir

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

Remove file: upyun.rmfile

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

Remove directory: upyun.rmdir

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

Create directory: upyun.mkdir

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

Refresh cache: upyun.refresh

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

Get file's meta: upyun.getFileMeta

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

View usage of directory: upyun.usage

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

Get file list of the directory: upyun.listDir

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

🐤 Related

upyun js sdk

upyun-webpack-plugin