Skip to content

ecomfe/edp-bcs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

edp-bcs

Build Status Dependencies Status

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(){});