This repository was archived by the owner on Mar 16, 2019. It is now read-only.
File tree Expand file tree Collapse file tree 4 files changed +35
-0
lines changed
Expand file tree Collapse file tree 4 files changed +35
-0
lines changed Original file line number Diff line number Diff line change @@ -137,6 +137,15 @@ function mkdir(path:string):Promise {
137137
138138}
139139
140+ /**
141+ * Returns the path for the app group.
142+ * @param {string } groupName Name of app group
143+ * @return {Promise }
144+ */
145+ function pathForAppGroup ( groupName :string ) :Promise {
146+ return RNFetchBlob . pathForAppGroup ( groupName ) ;
147+ }
148+
140149/**
141150 * Wrapper method of readStream.
142151 * @param {string } path Path of the file.
@@ -366,6 +375,7 @@ export default {
366375 writeStream,
367376 writeFile,
368377 appendFile,
378+ pathForAppGroup,
369379 readFile,
370380 exists,
371381 createFile,
Original file line number Diff line number Diff line change @@ -184,6 +184,20 @@ - (NSDictionary *)constantsToExport
184184
185185}
186186
187+ #pragma mark - fs.pathForAppGroup
188+ RCT_EXPORT_METHOD (pathForAppGroup:(NSString *)groupName
189+ resolver:(RCTPromiseResolveBlock)resolve
190+ rejecter:(RCTPromiseRejectBlock)reject)
191+ {
192+ NSString * path = [RNFetchBlobFS getPathForAppGroup: groupName];
193+
194+ if (path) {
195+ resolve (path);
196+ } else {
197+ reject (@" RNFetchBlob file not found" , @" could not find path for app group" , nil );
198+ }
199+ }
200+
187201#pragma mark - fs.exists
188202RCT_EXPORT_METHOD (exists:(NSString *)path callback:(RCTResponseSenderBlock)callback) {
189203 [RNFetchBlobFS exists: path callback: callback];
Original file line number Diff line number Diff line change 5252+ (NSString *) getDocumentDir ;
5353+ (NSString *) getTempPath : (NSString *)taskId withExtension : (NSString *)ext ;
5454+ (NSString *) getPathOfAsset : (NSString *)assetURI ;
55+ + (NSString *) getPathForAppGroup : (NSString *)groupName ;
5556+ (void ) getPathFromUri : (NSString *)uri completionHandler : (void (^)(NSString * path, ALAssetRepresentation *asset)) onComplete ;
5657
5758// fs methods
Original file line number Diff line number Diff line change @@ -129,6 +129,16 @@ + (NSString *) getTempPath:(NSString*)taskId withExtension:(NSString *)ext {
129129 return tempPath;
130130}
131131
132+ + (NSString *) getPathForAppGroup : (NSString *)groupName {
133+ NSFileManager * fileManager = [NSFileManager defaultManager ];
134+ NSURL * containerURL = [fileManager containerURLForSecurityApplicationGroupIdentifier: groupName];
135+ if (containerURL) {
136+ return [containerURL path ];
137+ } else {
138+ return nil ;
139+ }
140+ }
141+
132142#pragma margk - readStream
133143
134144+ (void ) readStream : (NSString *)uri
You can’t perform that action at this time.
0 commit comments