Browse Source

Increase IOS ASCII readFile performance

Ben Hsieh 8 years ago
parent
commit
8cb1d712d4
1 changed files with 6 additions and 6 deletions
  1. 6
    6
      src/ios/RNFetchBlobFS.m

+ 6
- 6
src/ios/RNFetchBlobFS.m View File

341
                     resolve([fileContent base64EncodedStringWithOptions:0]);
341
                     resolve([fileContent base64EncodedStringWithOptions:0]);
342
             }
342
             }
343
             else if ([[encoding lowercaseString] isEqualToString:@"ascii"]) {
343
             else if ([[encoding lowercaseString] isEqualToString:@"ascii"]) {
344
-                NSMutableArray * resultArray = [NSMutableArray array];
345
-                char * bytes = [fileContent bytes];
346
-                for(int i=0;i<[fileContent length];i++) {
347
-                    [resultArray addObject:[NSNumber numberWithChar:bytes[i]]];
348
-                }
344
+//                NSMutableArray * resultArray = [NSMutableArray array];
345
+//                char * bytes = [fileContent bytes];
346
+//                for(int i=0;i<[fileContent length];i++) {
347
+//                    [resultArray addObject:[NSNumber numberWithChar:bytes[i]]];
348
+//                }
349
                 if(resolve != nil)
349
                 if(resolve != nil)
350
-                    resolve(resultArray);
350
+                    resolve([[NSString alloc] initWithData:fileContent encoding:NSASCIIStringEncoding]);
351
             }
351
             }
352
         }];
352
         }];
353
     }
353
     }