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,7 +42,7 @@ public class RNFetchBlobFS {
42 42
                 String eventName = "RNFetchBlobStream+" + path;
43 43
                 try {
44 44
 
45
-                    int chunkSize = encoding.equalsIgnoreCase("base64") ? 1026 : 1024;
45
+                    int chunkSize = encoding.equalsIgnoreCase("base64") ? 4098 : 4096;
46 46
                     if(bufferSize > 0)
47 47
                         chunkSize = bufferSize;
48 48
                     FileInputStream fs = new FileInputStream(new File(path));

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

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