|
@@ -1,7 +1,7 @@
|
1
|
1
|
/**
|
2
|
2
|
* @name react-native-fetch-blob
|
3
|
3
|
* @author wkh237
|
4
|
|
- * @version 0.5.0
|
|
4
|
+ * @version 0.7.0
|
5
|
5
|
* @flow
|
6
|
6
|
*/
|
7
|
7
|
|
|
@@ -179,6 +179,8 @@ class FetchBlobResponse {
|
179
|
179
|
json : () => any;
|
180
|
180
|
base64 : () => any;
|
181
|
181
|
flush : () => void;
|
|
182
|
+ session : (name:string) => RNFetchBlobSession | null;
|
|
183
|
+ readFile : (encode: 'base64' | 'utf8' | 'ascii') => ?Promise;
|
182
|
184
|
readStream : (
|
183
|
185
|
encode: 'utf8' | 'ascii' | 'base64',
|
184
|
186
|
) => RNFetchBlobStream | null;
|
|
@@ -223,7 +225,10 @@ class FetchBlobResponse {
|
223
|
225
|
* @return {Promise}
|
224
|
226
|
*/
|
225
|
227
|
this.flush = () => {
|
226
|
|
- return unlink(this.path())
|
|
228
|
+ let path = this.path()
|
|
229
|
+ if(!path)
|
|
230
|
+ return
|
|
231
|
+ return unlink(path)
|
227
|
232
|
}
|
228
|
233
|
/**
|
229
|
234
|
* get path of response temp file
|
|
@@ -234,7 +239,7 @@ class FetchBlobResponse {
|
234
|
239
|
return this.data
|
235
|
240
|
return null
|
236
|
241
|
}
|
237
|
|
- this.session = (name) => {
|
|
242
|
+ this.session = (name:string):RNFetchBlobSession | null => {
|
238
|
243
|
if(this.type === 'path')
|
239
|
244
|
return session(name).add(this.data)
|
240
|
245
|
else {
|