edpx-bcs
v1.0.6
Published
edp bcs command package
Downloads
14
Readme
edp-bcs
Usage
edp
edp bcs a.js bs://<bucket>/a.js
edp bcs dir bs://<bucket>/dir
api
var bcs = require( 'edpx-bcs' );
var ak = '';
var sk = '';
var maxSize = 10 * 1024; // 10K
var autoUri = false;
// 上传文件
var sdk = new bcs.sdk.BaiduCloudStorage( ak, sk, maxSize, autoUri );
var def = sdk.upload( bucket, localFile );
def.done(function( url ){ console.log( url ) });
def.fail(function( e ){ console.error( e ) });
// 上传目录
var def = sdk.upload( bucket, localDir );
def.done(function( result ){
/** Array.<{item: string, url: string}> */
result.success;
/** Array.<{item: string, error: string}>*/
result.failure;
});
// def不会进入rejected的状态,不需要fail的处理函数.
// done.fail(function(){});