react-native-blob-util 0.19.11 → 0.21.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2,7 +2,7 @@ package com.ReactNativeBlobUtil;
2
2
 
3
3
  import androidx.annotation.Nullable;
4
4
 
5
- import com.facebook.react.TurboReactPackage;
5
+ import com.facebook.react.BaseReactPackage;
6
6
  import com.facebook.react.bridge.NativeModule;
7
7
  import com.facebook.react.bridge.ReactApplicationContext;
8
8
  import com.facebook.react.module.model.ReactModuleInfo;
@@ -11,7 +11,9 @@ import com.facebook.react.module.model.ReactModuleInfoProvider;
11
11
  import java.util.HashMap;
12
12
  import java.util.Map;
13
13
 
14
- public class ReactNativeBlobUtilPackage extends TurboReactPackage {
14
+ // trick autolinking till it is fixed on RN side
15
+ //public class ReactNativeBlobUtilPackage extends TurboReactPackage {
16
+ public class ReactNativeBlobUtilPackage extends BaseReactPackage {
15
17
 
16
18
  @Nullable
17
19
  @Override
@@ -35,7 +37,6 @@ public class ReactNativeBlobUtilPackage extends TurboReactPackage {
35
37
  ReactNativeBlobUtilImpl.NAME,
36
38
  false, // canOverrideExistingModule
37
39
  false, // needsEagerInit
38
- true, // hasConstants
39
40
  false, // isCxxModule
40
41
  isTurboModule // isTurboModule
41
42
  ));
@@ -24,6 +24,7 @@ import androidx.annotation.NonNull;
24
24
  import com.ReactNativeBlobUtil.Response.ReactNativeBlobUtilDefaultResp;
25
25
  import com.ReactNativeBlobUtil.Response.ReactNativeBlobUtilFileResp;
26
26
  import com.ReactNativeBlobUtil.Utils.Tls12SocketFactory;
27
+ import com.ReactNativeBlobUtil.ReactNativeBlobUtilFS;
27
28
  import com.facebook.common.logging.FLog;
28
29
  import com.facebook.react.bridge.Arguments;
29
30
  import com.facebook.react.bridge.Callback;
@@ -32,6 +33,7 @@ import com.facebook.react.bridge.ReadableMap;
32
33
  import com.facebook.react.bridge.ReadableMapKeySetIterator;
33
34
  import com.facebook.react.bridge.WritableArray;
34
35
  import com.facebook.react.bridge.WritableMap;
36
+ import com.facebook.react.bridge.ReactApplicationContext;
35
37
  import com.facebook.react.modules.core.DeviceEventManagerModule;
36
38
 
37
39
  import java.io.File;
@@ -114,6 +116,7 @@ public class ReactNativeBlobUtilReq extends BroadcastReceiver implements Runnabl
114
116
  String url;
115
117
  String rawRequestBody;
116
118
  String destPath;
119
+ String customPath;
117
120
  ReadableArray rawRequestBodyArray;
118
121
  ReadableMap headers;
119
122
  Callback callback;
@@ -234,7 +237,7 @@ public class ReactNativeBlobUtilReq extends BroadcastReceiver implements Runnabl
234
237
 
235
238
  @Override
236
239
  public void run() {
237
-
240
+ Context appCtx = ReactNativeBlobUtilImpl.RCTContext.getApplicationContext();
238
241
  // use download manager instead of default HTTP implementation
239
242
  if (options.addAndroidDownloads != null && options.addAndroidDownloads.hasKey("useDownloadManager")) {
240
243
 
@@ -253,14 +256,50 @@ public class ReactNativeBlobUtilReq extends BroadcastReceiver implements Runnabl
253
256
  req.setDescription(options.addAndroidDownloads.getString("description"));
254
257
  }
255
258
  if (options.addAndroidDownloads.hasKey("path")) {
256
- req.setDestinationUri(Uri.parse("file://" + options.addAndroidDownloads.getString("path")));
259
+ String path = options.addAndroidDownloads.getString("path");
260
+ File f = new File(path);
261
+ File dir = f.getParentFile();
262
+
263
+ if (!f.exists()) {
264
+ if (dir != null && !dir.exists()) {
265
+ if (!dir.mkdirs() && !dir.exists()) {
266
+ invoke_callback( "Failed to create parent directory of '" + path + "'", null, null);
267
+ return;
268
+ }
269
+ }
270
+ }
271
+ req.setDestinationUri(Uri.parse("file://" + path));
272
+
273
+ customPath = path;
274
+ }
275
+
276
+
277
+ if (options.addAndroidDownloads.hasKey("storeLocal") && options.addAndroidDownloads.getBoolean("storeLocal")) {
278
+ String path = (String) ReactNativeBlobUtilFS.getSystemfolders(ReactNativeBlobUtilImpl.RCTContext).get("DownloadDir");
279
+ path = path + UUID.randomUUID().toString();
280
+
281
+ File f = new File(path);
282
+ File dir = f.getParentFile();
283
+ if (!f.exists()) {
284
+ if (dir != null && !dir.exists()) {
285
+ if (!dir.mkdirs() && !dir.exists()) {
286
+ invoke_callback( "Failed to create parent directory of '" + path + "'", null, null);
287
+ return;
288
+ }
289
+ }
290
+ }
291
+ req.setDestinationUri(Uri.parse("file://" + path));
292
+ customPath = path;
257
293
  }
294
+
258
295
  if (options.addAndroidDownloads.hasKey("mime")) {
259
296
  req.setMimeType(options.addAndroidDownloads.getString("mime"));
260
297
  }
298
+
261
299
  if (options.addAndroidDownloads.hasKey("mediaScannable") && options.addAndroidDownloads.getBoolean("mediaScannable")) {
262
300
  req.allowScanningByMediaScanner();
263
301
  }
302
+
264
303
  if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q && options.addAndroidDownloads.hasKey("storeInDownloads") && options.addAndroidDownloads.getBoolean("storeInDownloads")) {
265
304
  String t = options.addAndroidDownloads.getString("title");
266
305
  if(t == null || t.isEmpty())
@@ -288,7 +327,7 @@ public class ReactNativeBlobUtilReq extends BroadcastReceiver implements Runnabl
288
327
  } catch (MalformedURLException e) {
289
328
  e.printStackTrace();
290
329
  }
291
- Context appCtx = ReactNativeBlobUtilImpl.RCTContext.getApplicationContext();
330
+
292
331
  DownloadManager dm = (DownloadManager) appCtx.getSystemService(Context.DOWNLOAD_SERVICE);
293
332
  downloadManagerId = dm.enqueue(req);
294
333
  androidDownloadManagerTaskTable.put(taskId, Long.valueOf(downloadManagerId));
@@ -296,7 +335,7 @@ public class ReactNativeBlobUtilReq extends BroadcastReceiver implements Runnabl
296
335
  appCtx.registerReceiver(this, new IntentFilter(DownloadManager.ACTION_DOWNLOAD_COMPLETE), Context.RECEIVER_EXPORTED);
297
336
  }else{
298
337
  appCtx.registerReceiver(this, new IntentFilter(DownloadManager.ACTION_DOWNLOAD_COMPLETE));
299
- }
338
+ }
300
339
  future = scheduledExecutorService.scheduleAtFixedRate(new Runnable() {
301
340
  @Override
302
341
  public void run() {
@@ -915,9 +954,9 @@ public class ReactNativeBlobUtilReq extends BroadcastReceiver implements Runnabl
915
954
  }
916
955
 
917
956
  // When the file is not found in media content database, check if custom path exists
918
- if (options.addAndroidDownloads.hasKey("path")) {
957
+ if (options.addAndroidDownloads.hasKey("path") || options.addAndroidDownloads.hasKey("storeLocal")) {
919
958
  try {
920
- String customDest = options.addAndroidDownloads.getString("path");
959
+ String customDest = customPath;
921
960
  boolean exists = new File(customDest).exists();
922
961
  if (!exists)
923
962
  throw new Exception("Download manager download failed, the file does not downloaded to destination.");
package/index.d.ts CHANGED
@@ -448,7 +448,7 @@ export interface FS {
448
448
 
449
449
  dirs: Dirs;
450
450
 
451
- slice(src: string, dest: string, start: number, end: number): Promise<void>;
451
+ slice(src: string, dest: string, start: number, end: number): Promise<string>;
452
452
 
453
453
  asset(path: string): string;
454
454
 
@@ -771,7 +771,7 @@ export interface AddAndroidDownloads {
771
771
  */
772
772
  description?: string;
773
773
  /**
774
- * The destination which the file will be downloaded, it SHOULD be a location on external storage (DCIMDir).
774
+ * The destination which the file will be downloaded, it SHOULD be a location on external storage (DCIMDir). CacheDir and DocumentDir don't work
775
775
  */
776
776
  path?: string;
777
777
  /**
@@ -779,7 +779,7 @@ export interface AddAndroidDownloads {
779
779
  */
780
780
  mime?: string;
781
781
  /**
782
- * A boolean value, see Officail Document
782
+ * A boolean value, see Official Document
783
783
  * (https://developer.android.com/reference/android/app/DownloadManager.html#addCompletedDownload(java.lang.String, java.lang.String, boolean, java.lang.String, java.lang.String, long, boolean))
784
784
  */
785
785
  mediaScannable?: boolean;
@@ -791,6 +791,11 @@ export interface AddAndroidDownloads {
791
791
  * A boolean value decide whether show a notification when download complete.
792
792
  */
793
793
  notification?: boolean;
794
+
795
+ /**
796
+ * If true android download manager will try to save the file to the apps Download direcotry
797
+ */
798
+ storeLocal?: boolean
794
799
  }
795
800
 
796
801
  export interface ReactNativeBlobUtilResponseInfo {
package/index.js.flow CHANGED
@@ -1,190 +1,191 @@
1
1
  // @flow strict
2
2
 
3
3
  declare class AndroidApi {
4
- actionViewIntent(path: string, mime?: string): Promise<void>;
5
- addCompleteDownload(options: AndroidDownloadOption): Promise<void>;
6
- getContentIntent(mime: string): Promise<string>;
7
- getSDCardApplicationDir(): Promise<string>;
8
- getSDCardDir(): Promise<string>;
4
+ actionViewIntent(path: string, mime?: string): Promise<void>;
5
+ addCompleteDownload(options: AndroidDownloadOption): Promise<void>;
6
+ getContentIntent(mime: string): Promise<string>;
7
+ getSDCardApplicationDir(): Promise<string>;
8
+ getSDCardDir(): Promise<string>;
9
9
  }
10
10
 
11
11
  declare class FetchBlobResponse {
12
- data: string;
13
- respInfo: ReactNativeBlobUtilResponseInfo;
14
- taskId: string;
15
- type: "utf8" | "base64" | "path";
16
- array(): Promise<number[]>;
17
- base64(): string | Promise<string>;
18
- blob(): Promise<Blob>;
19
- flush(): Promise<void>;
20
- info(): ReactNativeBlobUtilResponseInfo;
21
- // $FlowExpectedError Not possible to specify in strict mode.
22
- json(): any;
23
- path(): string;
24
- readFile(encoding: Encoding): ?Promise<number[] | string>;
25
- readStream(encoding: Encoding): ?Promise<ReactNativeBlobUtilReadStream>;
26
- session(name: string): ?ReactNativeBlobUtilSession;
27
- text(): string | Promise<string>;
12
+ data: string;
13
+ respInfo: ReactNativeBlobUtilResponseInfo;
14
+ taskId: string;
15
+ type: "utf8" | "base64" | "path";
16
+ array(): Promise<number[]>;
17
+ base64(): string | Promise<string>;
18
+ blob(): Promise<Blob>;
19
+ flush(): Promise<void>;
20
+ info(): ReactNativeBlobUtilResponseInfo;
21
+ // $FlowExpectedError Not possible to specify in strict mode.
22
+ json(): any;
23
+ path(): string;
24
+ readFile(encoding: Encoding): ?Promise<number[] | string>;
25
+ readStream(encoding: Encoding): ?Promise<ReactNativeBlobUtilReadStream>;
26
+ session(name: string): ?ReactNativeBlobUtilSession;
27
+ text(): string | Promise<string>;
28
28
  }
29
29
 
30
30
  declare class FsApi {
31
- ReactNativeBlobUtilSession: ReactNativeBlobUtilSession;
32
- dirs: Dirs;
33
- appendFile(path: string, data: string | number[], encoding?: Encoding | "uri"): Promise<number>;
34
- asset(path: string): string;
35
- cp(path: string, dest: string): Promise<boolean>;
36
- createFile(path: string, data: string, encoding: Encoding | "uri"): Promise<string>;
37
- df(): Promise<AndroidFsStat | IosFsStat>;
38
- exists(path: string): Promise<boolean>;
39
- hash(path: string, algorithm: HashAlgorithm): Promise<string>;
40
- isDir(path: string): Promise<boolean>;
41
- ls(path: string): Promise<string[]>;
42
- lstat(path: string): Promise<ReactNativeBlobUtilStat[]>;
43
- mkdir(path: string): Promise<boolean>;
44
- mv(path: string, dest: string): Promise<boolean>;
45
- pathForAppGroup(groupName: string): Promise<string>;
46
- readFile(path: string, encoding: Encoding, bufferSize?: number): Promise<number[] | string>;
47
- readStream(path: string, encoding: Encoding, bufferSize?: number, tick?: number): Promise<ReactNativeBlobUtilReadStream>;
48
- scanFile(pairs: {mime: string, path: string}[]): Promise<void>;
49
- session(name: string): ReactNativeBlobUtilSession;
50
- slice(src: string, dest: string, start: number, end: number): Promise<string>;
51
- stat(path: string): Promise<ReactNativeBlobUtilStat>;
52
- unlink(path: string): Promise<void>;
53
- writeFile(path: string, data: string | number[], encoding?: Encoding | "uri"): Promise<number>;
54
- writeStream(path: string, encoding: Encoding, append?: boolean): Promise<ReactNativeBlobUtilWriteStream>;
31
+ ReactNativeBlobUtilSession: ReactNativeBlobUtilSession;
32
+ dirs: Dirs;
33
+ appendFile(path: string, data: string | number[], encoding?: Encoding | "uri"): Promise<number>;
34
+ asset(path: string): string;
35
+ cp(path: string, dest: string): Promise<boolean>;
36
+ createFile(path: string, data: string, encoding: Encoding | "uri"): Promise<string>;
37
+ df(): Promise<AndroidFsStat | IosFsStat>;
38
+ exists(path: string): Promise<boolean>;
39
+ hash(path: string, algorithm: HashAlgorithm): Promise<string>;
40
+ isDir(path: string): Promise<boolean>;
41
+ ls(path: string): Promise<string[]>;
42
+ lstat(path: string): Promise<ReactNativeBlobUtilStat[]>;
43
+ mkdir(path: string): Promise<boolean>;
44
+ mv(path: string, dest: string): Promise<boolean>;
45
+ pathForAppGroup(groupName: string): Promise<string>;
46
+ readFile(path: string, encoding: Encoding, bufferSize?: number): Promise<number[] | string>;
47
+ readStream(path: string, encoding: Encoding, bufferSize?: number, tick?: number): Promise<ReactNativeBlobUtilReadStream>;
48
+ scanFile(pairs: { mime: string, path: string }[]): Promise<void>;
49
+ session(name: string): ReactNativeBlobUtilSession;
50
+ slice(src: string, dest: string, start: number, end: number): Promise<string>;
51
+ stat(path: string): Promise<ReactNativeBlobUtilStat>;
52
+ unlink(path: string): Promise<void>;
53
+ writeFile(path: string, data: string | number[], encoding?: Encoding | "uri"): Promise<number>;
54
+ writeStream(path: string, encoding: Encoding, append?: boolean): Promise<ReactNativeBlobUtilWriteStream>;
55
55
  }
56
56
 
57
57
  declare class IosApi {
58
- excludeFromBackupKey(path: string): Promise<void>;
59
- openDocument(path: string, scheme?: string): Promise<void>;
60
- previewDocument(path: string, scheme?: string): Promise<void>;
58
+ excludeFromBackupKey(path: string): Promise<void>;
59
+ openDocument(path: string, scheme?: string): Promise<void>;
60
+ previewDocument(path: string, scheme?: string): Promise<void>;
61
61
  }
62
62
 
63
63
  declare class ReactNativeBlobUtilReadStream {
64
- bufferSize?: number;
65
- closed: boolean;
66
- encoding: Encoding;
67
- path: string;
68
- tick: number;
69
- onData(fn: (chunk: string) => void): void;
70
- onEnd(fn: () => void): void;
71
- onError(fn: (err: Error) => void): void;
72
- open(): void;
64
+ bufferSize?: number;
65
+ closed: boolean;
66
+ encoding: Encoding;
67
+ path: string;
68
+ tick: number;
69
+ onData(fn: (chunk: string) => void): void;
70
+ onEnd(fn: () => void): void;
71
+ onError(fn: (err: Error) => void): void;
72
+ open(): void;
73
73
  }
74
74
 
75
75
  declare class ReactNativeBlobUtilSession {
76
- static getSession(name: string): ReactNativeBlobUtilSession;
77
- static removeSession(name: string): void;
78
- static setSession(name: string, val: ReactNativeBlobUtilSession): void;
76
+ static getSession(name: string): ReactNativeBlobUtilSession;
77
+ static removeSession(name: string): void;
78
+ static setSession(name: string, val: ReactNativeBlobUtilSession): void;
79
79
 
80
- name: string;
81
- add(path: string): ReactNativeBlobUtilSession;
82
- constructor(name: string, list: string[]): ReactNativeBlobUtilSession;
83
- dispose(): Promise<void>;
84
- list(): string[];
85
- remove(path: string): ReactNativeBlobUtilSession;
80
+ name: string;
81
+ add(path: string): ReactNativeBlobUtilSession;
82
+ constructor(name: string, list: string[]): ReactNativeBlobUtilSession;
83
+ dispose(): Promise<void>;
84
+ list(): string[];
85
+ remove(path: string): ReactNativeBlobUtilSession;
86
86
  }
87
87
 
88
88
  declare class ReactNativeBlobUtilWriteStream {
89
- append: boolean;
90
- encoding: string;
91
- id: string;
92
- close(): void;
93
- write(data: string): Promise<void>;
89
+ append: boolean;
90
+ encoding: string;
91
+ id: string;
92
+ close(): void;
93
+ write(data: string): Promise<void>;
94
94
  }
95
95
 
96
96
  declare class ReactNativeBlobUtil {
97
- android: AndroidApi;
98
- base64: {+decode: (input: string) => string, +encode: (input: string) => string};
99
- fs: FsApi;
100
- ios: IosApi;
101
- config(options: ReactNativeBlobUtilConfig): {fetch: (method: Methods, url: string, headers?: {[key: string]: string}, body?: string | FormField[]) => StatefulPromise<FetchBlobResponse>};
102
- fetch(method: Methods, url: string, headers?: {[key: string]: string}, body?: string | FormField[]): StatefulPromise<FetchBlobResponse>;
103
- session(name: string): ReactNativeBlobUtilSession;
104
- wrap(path: string): string;
97
+ android: AndroidApi;
98
+ base64: { +decode: (input: string) => string, +encode: (input: string) => string };
99
+ fs: FsApi;
100
+ ios: IosApi;
101
+ config(options: ReactNativeBlobUtilConfig): { fetch: (method: Methods, url: string, headers?: { [key: string]: string }, body?: string | FormField[]) => StatefulPromise<FetchBlobResponse> };
102
+ fetch(method: Methods, url: string, headers?: { [key: string]: string }, body?: string | FormField[]): StatefulPromise<FetchBlobResponse>;
103
+ session(name: string): ReactNativeBlobUtilSession;
104
+ wrap(path: string): string;
105
105
  }
106
106
 
107
107
  declare class StatefulPromise<T> extends Promise<T> {
108
- cancel(callback?: (error: ?string, taskId: ?string) => void): void;
109
- expire(callback: () => void): StatefulPromise<void>;
110
- progress(config: {count?: number, interval?: number} | ProgressCallback, callback?: ProgressCallback): StatefulPromise<T>;
111
- stateChange(callback: (state: ReactNativeBlobUtilResponseInfo) => void): StatefulPromise<T>;
112
- uploadProgress(config: {count?: number, interval?: number} | UploadProgressCallback, callback?: UploadProgressCallback): StatefulPromise<T>;
108
+ cancel(callback?: (error: ?string, taskId: ?string) => void): void;
109
+ expire(callback: () => void): StatefulPromise<void>;
110
+ progress(config: { count?: number, interval?: number } | ProgressCallback, callback?: ProgressCallback): StatefulPromise<T>;
111
+ stateChange(callback: (state: ReactNativeBlobUtilResponseInfo) => void): StatefulPromise<T>;
112
+ uploadProgress(config: { count?: number, interval?: number } | UploadProgressCallback, callback?: UploadProgressCallback): StatefulPromise<T>;
113
113
  }
114
114
 
115
115
  export type AddAndroidDownloads = {
116
- description?: string,
117
- mediaScannable?: boolean,
118
- mime?: string,
119
- notification?: boolean,
120
- path?: string,
121
- title?: string,
122
- useDownloadManager?: boolean
116
+ description?: string,
117
+ mediaScannable?: boolean,
118
+ mime?: string,
119
+ notification?: boolean,
120
+ path?: string,
121
+ title?: string,
122
+ useDownloadManager?: boolean,
123
+ storeLocal: boolean
123
124
  };
124
125
  export type AndroidDownloadOption = {
125
- description?: string,
126
- mime?: string,
127
- path: string,
128
- showNotification?: boolean,
129
- title?: string
126
+ description?: string,
127
+ mime?: string,
128
+ path: string,
129
+ showNotification?: boolean,
130
+ title?: string
130
131
  };
131
132
  export type AndroidFsStat = {
132
- external_free: number,
133
- external_total: number,
134
- internal_free: number,
135
- internal_total: number
133
+ external_free: number,
134
+ external_total: number,
135
+ internal_free: number,
136
+ internal_total: number
136
137
  };
137
138
  export type Dirs = {
138
- CacheDir: string,
139
- DCIMDir: string,
140
- DocumentDir: string,
141
- DownloadDir: string,
142
- LibraryDir: string,
143
- MainBundleDir: string,
144
- MovieDir: string,
145
- MusicDir: string,
146
- PictureDir: string,
147
- SDCardApplicationDir: string,
148
- SDCardDir: string
139
+ CacheDir: string,
140
+ DCIMDir: string,
141
+ DocumentDir: string,
142
+ DownloadDir: string,
143
+ LibraryDir: string,
144
+ MainBundleDir: string,
145
+ MovieDir: string,
146
+ MusicDir: string,
147
+ PictureDir: string,
148
+ SDCardApplicationDir: string,
149
+ SDCardDir: string
149
150
  };
150
151
  export type Encoding = "utf8" | "ascii" | "base64";
151
- export type FormField = {data: string, filename?: string, name: string, type?: string};
152
+ export type FormField = { data: string, filename?: string, name: string, type?: string };
152
153
  export type HashAlgorithm = "md5" | "sha1" | "sha224" | "sha256" | "sha384" | "sha512";
153
- export type IosFsStat = {free: number, total: number};
154
+ export type IosFsStat = { free: number, total: number };
154
155
  export type Methods = "POST" | "GET" | "DELETE" | "PUT" | "post" | "get" | "delete" | "put";
155
156
  export type ProgressCallback = (received: number, total: number) => void;
156
157
  export type ReactNativeBlobUtilConfig = {
157
- Progress?: { count?: number, interval?: number },
158
- UploadProgress?: { count?: number, interval?: number },
159
- IOSBackgroundTask?: boolean,
160
- addAndroidDownloads?: AddAndroidDownloads,
161
- appendExt?: string,
162
- fileCache?: boolean,
163
- indicator?: boolean,
164
- overwrite?: boolean,
165
- path?: string,
166
- session?: string,
167
- timeout?: number,
168
- trusty?: boolean,
169
- wifiOnly?: boolean,
170
- followRedirect?: boolean
158
+ Progress?: { count?: number, interval?: number },
159
+ UploadProgress?: { count?: number, interval?: number },
160
+ IOSBackgroundTask?: boolean,
161
+ addAndroidDownloads?: AddAndroidDownloads,
162
+ appendExt?: string,
163
+ fileCache?: boolean,
164
+ indicator?: boolean,
165
+ overwrite?: boolean,
166
+ path?: string,
167
+ session?: string,
168
+ timeout?: number,
169
+ trusty?: boolean,
170
+ wifiOnly?: boolean,
171
+ followRedirect?: boolean
171
172
  };
172
173
  export type ReactNativeBlobUtilResponseInfo = {
173
- headers: {[fieldName: string]: string},
174
- redirects: string[],
175
- respType: "text" | "blob" | "" | "json",
176
- rnfbEncode: "path" | Encoding,
177
- state: string,
178
- status: number,
179
- taskId: string,
180
- timeout: boolean
174
+ headers: { [fieldName: string]: string },
175
+ redirects: string[],
176
+ respType: "text" | "blob" | "" | "json",
177
+ rnfbEncode: "path" | Encoding,
178
+ state: string,
179
+ status: number,
180
+ taskId: string,
181
+ timeout: boolean
181
182
  };
182
183
  export type ReactNativeBlobUtilStat = {
183
- filename: string,
184
- lastModified: number,
185
- path: string,
186
- size: number,
187
- type: "directory" | "file" | "asset"
184
+ filename: string,
185
+ lastModified: number,
186
+ path: string,
187
+ size: number,
188
+ type: "directory" | "file" | "asset"
188
189
  };
189
190
  export type UploadProgressCallback = (sent: number, total: number) => void;
190
191
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-blob-util",
3
- "version": "0.19.11",
3
+ "version": "0.21.2",
4
4
  "description": "A module provides upload, download, and files access API. Supports file stream read/write for process large files.",
5
5
  "main": "index",
6
6
  "scripts": {
package/types.js CHANGED
@@ -2,16 +2,16 @@
2
2
  export type ReactNativeBlobUtilConfig = {
3
3
  Progress: any,
4
4
  UploadProgress: any,
5
- fileCache : bool,
5
+ fileCache : boolean,
6
6
  transformFile: boolean;
7
7
  path : string,
8
8
  appendExt : string,
9
9
  session : string,
10
10
  addAndroidDownloads : any,
11
- indicator : bool,
12
- followRedirect : bool,
13
- trusty : bool,
14
- wifiOnly : bool
11
+ indicator : boolean,
12
+ followRedirect : boolean,
13
+ trusty : boolean,
14
+ wifiOnly : boolean
15
15
  };
16
16
 
17
17
  export type ReactNativeBlobUtilNative = {