|
@@ -171,12 +171,12 @@ function writeFile(path:string, data:string | Array<number>, encoding:?string):P
|
171
|
171
|
return Promise.reject('Invalid argument "path" ')
|
172
|
172
|
if(encoding.toLocaleLowerCase() === 'ascii') {
|
173
|
173
|
if(!Array.isArray(data))
|
174
|
|
- Promise.reject(new Error(`Expected "data" is an Array when encoding is "ascii", however got ${typeof data}`))
|
|
174
|
+ return Promise.reject(new Error(`Expected "data" is an Array when encoding is "ascii", however got ${typeof data}`))
|
175
|
175
|
else
|
176
|
176
|
return RNFetchBlob.writeFileArray(path, data, false);
|
177
|
177
|
} else {
|
178
|
178
|
if(typeof data !== 'string')
|
179
|
|
- Promise.reject(new Error(`Expected "data" is a String when encoding is "utf8" or "base64", however got ${typeof data}`))
|
|
179
|
+ return Promise.reject(new Error(`Expected "data" is a String when encoding is "utf8" or "base64", however got ${typeof data}`))
|
180
|
180
|
else
|
181
|
181
|
return RNFetchBlob.writeFile(path, encoding, data, false);
|
182
|
182
|
}
|
|
@@ -188,12 +188,12 @@ function appendFile(path:string, data:string | Array<number>, encoding:?string):
|
188
|
188
|
return Promise.reject('Invalid argument "path" ')
|
189
|
189
|
if(encoding.toLocaleLowerCase() === 'ascii') {
|
190
|
190
|
if(!Array.isArray(data))
|
191
|
|
- Promise.reject(new Error(`Expected "data" is an Array when encoding is "ascii", however got ${typeof data}`))
|
|
191
|
+ return Promise.reject(new Error(`Expected "data" is an Array when encoding is "ascii", however got ${typeof data}`))
|
192
|
192
|
else
|
193
|
193
|
return RNFetchBlob.writeFileArray(path, data, true);
|
194
|
194
|
} else {
|
195
|
195
|
if(typeof data !== 'string')
|
196
|
|
- Promise.reject(new Error(`Expected "data" is a String when encoding is "utf8" or "base64", however got ${typeof data}`))
|
|
196
|
+ return Promise.reject(new Error(`Expected "data" is a String when encoding is "utf8" or "base64", however got ${typeof data}`))
|
197
|
197
|
else
|
198
|
198
|
return RNFetchBlob.writeFile(path, encoding, data, true);
|
199
|
199
|
}
|