瀏覽代碼

Change default stream buffer size to 4096

Ben Hsieh 8 年之前
父節點
當前提交
493597180a
共有 2 個檔案被更改,包括 3 行新增3 行删除
  1. 1
    1
      src/android/src/main/java/com/RNFetchBlob/RNFetchBlobFS.java
  2. 2
    2
      src/ios/RNFetchBlob/RNFetchBlob.m

+ 1
- 1
src/android/src/main/java/com/RNFetchBlob/RNFetchBlobFS.java 查看文件

@@ -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 查看文件

@@ -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];