File tree Expand file tree Collapse file tree 1 file changed +61
-0
lines changed Expand file tree Collapse file tree 1 file changed +61
-0
lines changed Original file line number Diff line number Diff line change @@ -3768,3 +3768,64 @@ group('getStream() 流式下载 ECONNREFUSED 错误', function () {
3768
3768
} ) ;
3769
3769
} ) ;
3770
3770
} ) ;
3771
+
3772
+ group ( 'appendObject' , function ( ) {
3773
+ test ( 'appendObject()' , function ( done , assert ) {
3774
+ cos . headObject ( {
3775
+ Bucket : config . Bucket , // Bucket 格式:test-1250000000
3776
+ Region : config . Region ,
3777
+ Key : 'append.txt' , /* 必须 */
3778
+ } , function ( err , data ) {
3779
+ assert . ok ( ! err ) ;
3780
+ if ( err ) return console . log ( err ) ;
3781
+ // 首先取到要追加的文件当前长度,即需要上送的Position
3782
+ var position = data . headers [ 'content-length' ] ;
3783
+ cos . appendObject ( {
3784
+ Bucket : config . Bucket , // Bucket 格式:test-1250000000
3785
+ Region : config . Region ,
3786
+ Key : 'append.txt' , /* 必须 */
3787
+ Body : '66666' ,
3788
+ Position : position ,
3789
+ } ,
3790
+ function ( err , data ) {
3791
+ assert . ok ( ! err ) ;
3792
+ done ( ) ;
3793
+ } )
3794
+ } ) ;
3795
+ } ) ;
3796
+ } ) ;
3797
+
3798
+ group ( '数据万象' , function ( ) {
3799
+ test ( 'describeMediaBuckets()' , function ( done , assert ) {
3800
+ cos . describeMediaBuckets ( {
3801
+ Bucket : config . Bucket ,
3802
+ Region : config . Region ,
3803
+ } ,
3804
+ function ( err , data ) {
3805
+ assert . ok ( ! err ) ;
3806
+ done ( ) ;
3807
+ } ) ;
3808
+ } ) ;
3809
+ test ( 'getMediaInfo()' , function ( done , assert ) {
3810
+ cos . getMediaInfo ( {
3811
+ Bucket : config . Bucket ,
3812
+ Region : config . Region ,
3813
+ Key : 'test.mp4' ,
3814
+ } ,
3815
+ function ( err , data ) {
3816
+ assert . ok ( ! err ) ;
3817
+ done ( ) ;
3818
+ } ) ;
3819
+ } ) ;
3820
+ test ( 'describeMediaBuckets()' , function ( done , assert ) {
3821
+ cos . getSnapshot ( {
3822
+ Bucket : config . Bucket ,
3823
+ Region : config . Region ,
3824
+ Key : 'test.mp4' ,
3825
+ } ,
3826
+ function ( err , data ) {
3827
+ assert . ok ( ! err ) ;
3828
+ done ( ) ;
3829
+ } ) ;
3830
+ } ) ;
3831
+ } ) ;
You can’t perform that action at this time.
0 commit comments