(String filepath, Promise promise)
| 625 | } |
| 626 | |
| 627 | @ReactMethod |
| 628 | public void stat(String filepath, Promise promise) { |
| 629 | try { |
| 630 | String originalFilepath = getOriginalFilepath(filepath, true); |
| 631 | File file = new File(originalFilepath); |
| 632 | |
| 633 | if (!file.exists()) throw new Exception("File does not exist"); |
| 634 | |
| 635 | WritableMap statMap = Arguments.createMap(); |
| 636 | statMap.putInt("ctime", (int) (file.lastModified() / 1000)); |
| 637 | statMap.putInt("mtime", (int) (file.lastModified() / 1000)); |
| 638 | statMap.putDouble("size", (double) file.length()); |
| 639 | statMap.putInt("type", file.isDirectory() ? 1 : 0); |
| 640 | statMap.putString("originalFilepath", originalFilepath); |
| 641 | |
| 642 | promise.resolve(statMap); |
| 643 | } catch (Exception ex) { |
| 644 | ex.printStackTrace(); |
| 645 | reject(promise, filepath, ex); |
| 646 | } |
| 647 | } |
| 648 | |
| 649 | @ReactMethod |
| 650 | public void unlink(String filepath, Promise promise) { |
nothing calls this directly
no test coverage detected