@@ -1335,20 +1335,20 @@ function moveObject() {
13351335 Key : source ,
13361336 Body : 'hello!' ,
13371337 } , function ( err , data ) {
1338- if ( err ) return logger . log ( err ) ;
1338+ if ( err ) return console . log ( err ) ;
13391339 cos . putObjectCopy ( {
13401340 Bucket : config . Bucket ,
13411341 Region : config . Region ,
13421342 Key : target ,
13431343 CopySource : copySource ,
13441344 } , function ( err , data ) {
1345- if ( err ) return logger . log ( err ) ;
1345+ if ( err ) return console . log ( err ) ;
13461346 cos . deleteObject ( {
13471347 Bucket : config . Bucket ,
13481348 Region : config . Region ,
13491349 Key : source ,
13501350 } , function ( err , data ) {
1351- logger . log ( err || data ) ;
1351+ console . log ( err || data ) ;
13521352 } ) ;
13531353 } ) ;
13541354 } ) ;
@@ -1391,7 +1391,7 @@ function uploadFolder() {
13911391
13921392/* 创建文件夹 */
13931393function createFolder ( ) {
1394- cos . getBucket ( {
1394+ cos . putObject ( {
13951395 Bucket : config . Bucket ,
13961396 Region : config . Region ,
13971397 Key : 'folder/' , // 对象存储没有实际的文件夹,可以创建一个路径以 / 结尾的空对象表示,能在部分场景中满足文件夹使用需要
@@ -1543,7 +1543,7 @@ function appendObject_continue() {
15431543 } , function ( err , data ) {
15441544 if ( err ) return console . log ( err ) ;
15451545 // 首先取到要追加的文件当前长度,即需要上送的Position
1546- var position = data . headers [ 'content-length' ] ;
1546+ var position = data . headers && data . headers [ 'content-length' ] ;
15471547 cos . appendObject ( {
15481548 Bucket : config . Bucket , // Bucket 格式:test-1250000000
15491549 Region : config . Region ,
@@ -1553,7 +1553,7 @@ function appendObject_continue() {
15531553 } ,
15541554 function ( err , data ) {
15551555 // 也可以取到下一次上传的position继续追加上传
1556- var nextPosition = data . headers [ 'x-cos-next-append-position' ] ;
1556+ var nextPosition = data . headers && data . headers [ 'x-cos-next-append-position' ] ;
15571557 console . log ( err || data ) ;
15581558 } )
15591559 } ) ;
@@ -2753,6 +2753,7 @@ function DescribeAuditJob() {
27532753 var jobId = 'st3bb560af647911ec919652540024deb5' ;
27542754 cos . request ( {
27552755 Url : `https://${ config . Bucket } .ci.${ config . Region } .myqcloud.com/text/auditing/${ jobId } ` ,
2756+ Method : 'GET' ,
27562757 } , function ( err , data ) {
27572758 console . log ( err || data . Response . JobsDetail ) ;
27582759 } ) ;
0 commit comments