This repository was archived by the owner on Mar 16, 2019. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +31
-0
lines changed Expand file tree Collapse file tree 3 files changed +31
-0
lines changed Original file line number Diff line number Diff line change @@ -470,6 +470,11 @@ - (NSDictionary *)constantsToExport
470
470
}
471
471
})
472
472
473
+ RCT_EXPORT_METHOD (df:(RCTResponseSenderBlock)callback
474
+ {
475
+ [RNFetchBlobFS df: callback];
476
+ })
477
+
473
478
- (UIViewController *) documentInteractionControllerViewControllerForPreview : (UIDocumentInteractionController *) controller {
474
479
UIWindow *window = [UIApplication sharedApplication ].keyWindow ;
475
480
return window.rootViewController ;
Original file line number Diff line number Diff line change 66
66
// + (void) writeFileFromFile:(NSString *)src toFile:(NSString *)dest append:(BOOL)append;
67
67
+ (void ) writeAssetToPath : (ALAssetRepresentation * )rep dest : (NSString *)dest ;
68
68
+ (void ) readStream : (NSString *)uri encoding : (NSString * )encoding bufferSize : (int )bufferSize tick : (int )tick streamId : (NSString *)streamId bridgeRef : (RCTBridge *)bridgeRef ;
69
+ + (void ) df : (RCTResponseSenderBlock)callback ;
69
70
70
71
// constructor
71
72
- (id ) init ;
Original file line number Diff line number Diff line change @@ -722,6 +722,31 @@ + (void) getPathFromUri:(NSString *)uri completionHandler:(void(^)(NSString * pa
722
722
}
723
723
}
724
724
725
+ #pragma mark - get disk space
726
+
727
+ +(void ) df : (RCTResponseSenderBlock)callback
728
+ {
729
+ uint64_t totalSpace = 0 ;
730
+ uint64_t totalFreeSpace = 0 ;
731
+ NSError *error = nil ;
732
+ NSArray *paths = NSSearchPathForDirectoriesInDomains (NSDocumentDirectory, NSUserDomainMask, YES );
733
+ NSDictionary *dictionary = [[NSFileManager defaultManager ] attributesOfFileSystemForPath: [paths lastObject ] error: &error];
734
+
735
+ if (dictionary) {
736
+ NSNumber *fileSystemSizeInBytes = [dictionary objectForKey: NSFileSystemSize ];
737
+ NSNumber *freeFileSystemSizeInBytes = [dictionary objectForKey: NSFileSystemFreeSize ];
738
+ totalSpace = [fileSystemSizeInBytes unsignedLongLongValue ];
739
+ totalFreeSpace = [freeFileSystemSizeInBytes unsignedLongLongValue ];
740
+ callback (@[[NSNull null ], @{
741
+ @" free" : [NSNumber numberWithInt: totalFreeSpace],
742
+ @" total" : [NSNumber numberWithInt: totalSpace]
743
+ }]);
744
+ } else {
745
+ callback (@[@" failed to get storage usage." ]);
746
+ }
747
+
748
+ }
749
+
725
750
+ (void ) writeAssetToPath : (ALAssetRepresentation * )rep dest : (NSString *)dest
726
751
{
727
752
int read = 0 ;
You can’t perform that action at this time.
0 commit comments