diff --git a/CMDataStorage/CMDataStorage.h b/CMDataStorage/CMDataStorage.h index c1c3c44..310acda 100644 --- a/CMDataStorage/CMDataStorage.h +++ b/CMDataStorage/CMDataStorage.h @@ -105,4 +105,22 @@ */ - (NSString *)filePathWithKey:(NSString *)key; +/** +Returns a new array containing the CMDataStorage files paths. + + The order of the elements in the array is not defined. + + @return The NSArray object with all files url stored in CMDataStorage folder. + */ +- (NSArray*)allKeysURLs; + +/** + Returns a new array containing the CMDataStorage files paths. + + The order of the elements in the array is not defined. + + @return The NSArray object with all files paths stored in + */ +- (NSArray*)allKeysPaths; + @end diff --git a/CMDataStorage/CMDataStorage.m b/CMDataStorage/CMDataStorage.m index a2befd8..b2e9ec4 100644 --- a/CMDataStorage/CMDataStorage.m +++ b/CMDataStorage/CMDataStorage.m @@ -202,6 +202,16 @@ - (NSString *)filePathWithKey:(NSString *)key { return [[self fileURLWithKey:key] path]; } +- (NSArray*)allKeysURLs { + NSArray *dirContents = [get_file_manager() contentsOfDirectoryAtURL:self.cachePath includingPropertiesForKeys:nil options:0 error:nil]; + return dirContents; +} + +- (NSArray*)allKeysPaths { + NSArray *dirContents = [get_file_manager() contentsOfDirectoryAtPath:[self.cachePath path] error:nil]; + return dirContents; +} + #pragma mark - Private