@@ -5621,15 +5621,14 @@ module.exports = function(AV) {
56215621 data . blob . type = guessedType ;
56225622 }
56235623 this . _source = AV . Promise . as ( data . blob , guessedType ) ;
5624- } else if ( typeof ( File ) !== "undefined" && data instanceof global . File ) {
5624+ } else if ( typeof File !== "undefined" && data instanceof global . File ) {
56255625 this . _source = AV . Promise . as ( data , guessedType ) ;
5626- } else if ( avConfig . isNode && global . Buffer . isBuffer ( data ) ) {
5626+ } else if ( typeof global . Buffer !== "undefined" && global . Buffer . isBuffer ( data ) ) {
56275627 // use global.Buffer to prevent browserify pack Buffer module
5628- this . attributes . base64 = data . toString ( 'base64' ) ;
5629- this . _source = AV . Promise . as ( this . attributes . base64 , guessedType ) ;
56305628 this . attributes . metaData . size = data . length ;
5629+ this . _source = AV . Promise . as ( data , guessedType ) ;
56315630 } else if ( _ . isString ( data ) ) {
5632- throw "Creating a AV.File from a String is not yet supported." ;
5631+ throw new Error ( "Creating a AV.File from a String is not yet supported." ) ;
56335632 }
56345633 } ;
56355634
@@ -5956,6 +5955,9 @@ module.exports = function(AV) {
59565955 if ( this . attributes . base64 ) {
59575956 data . base64 = this . attributes . base64 ;
59585957 return AV . _request ( 'files' , this . attributes . name , null , 'POST' , data ) ;
5958+ } else if ( typeof global . Buffer !== "undefined" && global . Buffer . isBuffer ( file ) ) {
5959+ data . base64 = file . toString ( 'base64' ) ;
5960+ return AV . _request ( 'files' , this . attributes . name , null , 'POST' , data ) ;
59595961 } else {
59605962 return readAsync ( file ) . then ( function ( base64 ) {
59615963 data . base64 = base64 ;
@@ -11053,6 +11055,7 @@ module.exports = function(AV) {
1105311055'use strict' ;
1105411056
1105511057const request = require ( 'superagent' ) ;
11058+ const debug = require ( 'debug' ) ( 'cos' ) ;
1105611059const Promise = require ( '../promise' ) ;
1105711060
1105811061module . exports = function upload ( uploadInfo , data , file , saveOptions = { } ) {
@@ -11086,7 +11089,7 @@ module.exports = function upload(uploadInfo, data, file, saveOptions = {}) {
1108611089 return promise ;
1108711090} ;
1108811091
11089- } , { "../promise" :33 , "superagent" :12 } ] , 41 :[ function ( require , module , exports ) {
11092+ } , { "../promise" :33 , "debug" : 4 , " superagent" :12 } ] , 41 :[ function ( require , module , exports ) {
1109011093/**
1109111094 * 每位工程师都有保持代码优雅的义务
1109211095 * Each engineer has a duty to keep the code elegant
@@ -13011,7 +13014,7 @@ module.exports = {
1301113014
1301213015'use strict' ;
1301313016
13014- module . exports = 'js1.0.0-rc9' ;
13017+ module . exports = 'js1.0.0-rc9.1 ' ;
1301513018
1301613019} , { } ] } , { } , [ 20 ] ) ( 20 )
1301713020} ) ;
0 commit comments