rename exist to exists

This commit is contained in:
iwater 2016-01-29 02:20:02 +08:00
parent dd320b3a5a
commit f3dd33c003
4 changed files with 6 additions and 6 deletions

View File

@ -15,7 +15,7 @@ var base64 = require('base-64');
var utf8 = require('utf8');
var _readDir = Promise.promisify(RNFSManager.readDir);
var _exist = Promise.promisify(RNFSManager.exist);
var _exists = Promise.promisify(RNFSManager.exists);
var _stat = Promise.promisify(RNFSManager.stat);
var _readFile = Promise.promisify(RNFSManager.readFile);
var _writeFile = Promise.promisify(RNFSManager.writeFile);
@ -83,8 +83,8 @@ var RNFS = {
.catch(convertError);
},
exist(filepath) {
return _exist(filepath)
exists(filepath) {
return _exists(filepath)
.catch(convertError);
},

View File

@ -200,7 +200,7 @@ The promise resolves with an array, which contains a boolean and the path that h
Also recursively deletes directories (works like Linux `rm -rf`).
### `promise exist(filepath)`
### `promise exists(filepath)`
check if the item exist at `filepath`. If the item does not exist, return false.

View File

@ -56,7 +56,7 @@ RCT_EXPORT_METHOD(readDir:(NSString *)dirPath
callback(@[[NSNull null], contents]);
}
RCT_EXPORT_METHOD(exist:(NSString *)filepath
RCT_EXPORT_METHOD(exists:(NSString *)filepath
callback:(RCTResponseSenderBlock)callback)
{
BOOL fileExists = [[NSFileManager defaultManager] fileExistsAtPath:filepath];

View File

@ -73,7 +73,7 @@ public class RNFSManager extends ReactContextBaseJavaModule {
}
@ReactMethod
public void exist(String filepath, Callback callback) {
public void exists(String filepath, Callback callback) {
try {
File file = new File(filepath);
callback.invoke(null, file.exists());