MCPcopy Create free account
hub / github.com/itinance/react-native-fs / stat

Method stat

android/src/main/java/com/rnfs/RNFSManager.java:627–647  ·  view source on GitHub ↗
(String filepath, Promise promise)

Source from the content-addressed store, hash-verified

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) {

Callers

nothing calls this directly

Calls 3

getOriginalFilepathMethod · 0.95
rejectMethod · 0.95
existsMethod · 0.45

Tested by

no test coverage detected