This repository was archived by the owner on Mar 16, 2019. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +22
-4
lines changed Expand file tree Collapse file tree 1 file changed +22
-4
lines changed Original file line number Diff line number Diff line change @@ -202,8 +202,8 @@ function fetch(...args:any):Promise {
202202 let count = - 1
203203 let fn = ( ) => { }
204204 if ( args . length === 2 ) {
205- interval = args [ 0 ] . interval
206- interval = args [ 0 ] . count
205+ interval = args [ 0 ] . interval || interval
206+ count = args [ 0 ] . count || count
207207 fn = args [ 1 ]
208208 }
209209 else {
@@ -218,8 +218,8 @@ function fetch(...args:any):Promise {
218218 let count = - 1
219219 let fn = ( ) => { }
220220 if ( args . length === 2 ) {
221- interval = args [ 0 ] . interval
222- interval = args [ 0 ] . count
221+ interval = args [ 0 ] . interval || interval
222+ count = args [ 0 ] . count || count
223223 fn = args [ 1 ]
224224 }
225225 else {
@@ -276,6 +276,24 @@ class FetchBlobResponse {
276276 this . info = ( ) :RNFetchBlobResponseInfo => {
277277 return this . respInfo
278278 }
279+
280+ this . array = ( ) :Promise < Array > => {
281+ let cType = info . headers [ 'Content-Type' ] || info . headers [ 'content-type' ]
282+ return new Promise ( ( resolve , reject ) => {
283+ switch ( this . type ) {
284+ case 'base64' :
285+ // TODO : base64 to array buffer
286+ break
287+ case 'path' :
288+ fs . readFile ( this . data , 'ascii' ) . then ( resolve )
289+ break
290+ default :
291+ // TODO : text to array buffer
292+ break
293+ }
294+ } )
295+ }
296+
279297 /**
280298 * Convert result to javascript RNFetchBlob object.
281299 * @return {Promise<Blob> } Return a promise resolves Blob object.
You can’t perform that action at this time.
0 commit comments