File tree 4 files changed +35
-0
lines changed
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 {
137
137
138
138
}
139
139
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
+
140
149
/**
141
150
* Wrapper method of readStream.
142
151
* @param {string } path Path of the file.
@@ -366,6 +375,7 @@ export default {
366
375
writeStream,
367
376
writeFile,
368
377
appendFile,
378
+ pathForAppGroup,
369
379
readFile,
370
380
exists,
371
381
createFile,
Original file line number Diff line number Diff line change @@ -184,6 +184,20 @@ - (NSDictionary *)constantsToExport
184
184
185
185
}
186
186
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
+
187
201
#pragma mark - fs.exists
188
202
RCT_EXPORT_METHOD (exists:(NSString *)path callback:(RCTResponseSenderBlock)callback) {
189
203
[RNFetchBlobFS exists: path callback: callback];
Original file line number Diff line number Diff line change 52
52
+ (NSString *) getDocumentDir ;
53
53
+ (NSString *) getTempPath : (NSString *)taskId withExtension : (NSString *)ext ;
54
54
+ (NSString *) getPathOfAsset : (NSString *)assetURI ;
55
+ + (NSString *) getPathForAppGroup : (NSString *)groupName ;
55
56
+ (void ) getPathFromUri : (NSString *)uri completionHandler : (void (^)(NSString * path, ALAssetRepresentation *asset)) onComplete ;
56
57
57
58
// fs methods
Original file line number Diff line number Diff line change @@ -129,6 +129,16 @@ + (NSString *) getTempPath:(NSString*)taskId withExtension:(NSString *)ext {
129
129
return tempPath;
130
130
}
131
131
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
+
132
142
#pragma margk - readStream
133
143
134
144
+ (void ) readStream : (NSString *)uri
You can’t perform that action at this time.
0 commit comments