|
@@ -134,10 +134,14 @@ function mkdir(path:string):Promise {
|
134
|
134
|
* @return {Promise<Array<number> | string>}
|
135
|
135
|
*/
|
136
|
136
|
function readFile(path:string, encoding:string, bufferSize:number):Promise<any> {
|
|
137
|
+ if(typeof path !== 'string')
|
|
138
|
+ return Promise.reject('Invalid argument "path" ')
|
137
|
139
|
return RNFetchBlob.readFile(path, encoding)
|
138
|
140
|
}
|
139
|
141
|
|
140
|
142
|
function writeFile(path:string, encoding:string, data:string | Array<number>):Promise {
|
|
143
|
+ if(typeof path !== 'string')
|
|
144
|
+ return Promise.reject('Invalid argument "path" ')
|
141
|
145
|
if(encoding.toLocaleLowerCase() === 'ascii') {
|
142
|
146
|
if(!Array.isArray(data))
|
143
|
147
|
Promise.reject(`Expected "data" is an Array when encoding is "ascii", however got ${typeof data}`)
|
|
@@ -286,6 +290,8 @@ export default {
|
286
|
290
|
mv,
|
287
|
291
|
cp,
|
288
|
292
|
writeStream,
|
|
293
|
+ writeFile,
|
|
294
|
+ readFile,
|
289
|
295
|
exists,
|
290
|
296
|
createFile,
|
291
|
297
|
isDir,
|