Browse Source

Change default stream buffer size to 4096

Ben Hsieh 8 years ago
parent
commit
493597180a

+ 1
- 1
src/android/src/main/java/com/RNFetchBlob/RNFetchBlobFS.java View File

42
                 String eventName = "RNFetchBlobStream+" + path;
42
                 String eventName = "RNFetchBlobStream+" + path;
43
                 try {
43
                 try {
44
 
44
 
45
-                    int chunkSize = encoding.equalsIgnoreCase("base64") ? 1026 : 1024;
45
+                    int chunkSize = encoding.equalsIgnoreCase("base64") ? 4098 : 4096;
46
                     if(bufferSize > 0)
46
                     if(bufferSize > 0)
47
                         chunkSize = bufferSize;
47
                         chunkSize = bufferSize;
48
                     FileInputStream fs = new FileInputStream(new File(path));
48
                     FileInputStream fs = new FileInputStream(new File(path));

+ 2
- 2
src/ios/RNFetchBlob/RNFetchBlob.m View File

187
         case NSStreamEventHasBytesAvailable:
187
         case NSStreamEventHasBytesAvailable:
188
         {
188
         {
189
             NSMutableData * chunkData = [[NSMutableData data] init];
189
             NSMutableData * chunkData = [[NSMutableData data] init];
190
-            NSInteger chunkSize = 1024;
190
+            NSInteger chunkSize = 4096;
191
             if([[self.encoding lowercaseString] isEqualToString:@"base64"])
191
             if([[self.encoding lowercaseString] isEqualToString:@"base64"])
192
-                chunkSize = 1026;
192
+                chunkSize = 4098;
193
             if(self.bufferSize > 0)
193
             if(self.bufferSize > 0)
194
                 chunkSize = self.bufferSize;
194
                 chunkSize = self.bufferSize;
195
             uint8_t buf[chunkSize];
195
             uint8_t buf[chunkSize];