react-native-blob-util 0.24.5 → 0.24.7

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.
Files changed (98) hide show
  1. package/.eslintrc.json +96 -96
  2. package/LICENSE +21 -21
  3. package/Migration.md +41 -41
  4. package/NuGet.config +11 -11
  5. package/README.md +1109 -1109
  6. package/android/gradle.properties +1 -1
  7. package/android/src/main/AndroidManifest.xml +37 -37
  8. package/android/src/main/java/com/ReactNativeBlobUtil/ReactNativeBlobUtilConfig.java +59 -59
  9. package/android/src/main/java/com/ReactNativeBlobUtil/ReactNativeBlobUtilConst.java +20 -20
  10. package/android/src/main/java/com/ReactNativeBlobUtil/ReactNativeBlobUtilFileTransformer.java +9 -9
  11. package/android/src/main/java/com/ReactNativeBlobUtil/ReactNativeBlobUtilImpl.java +431 -431
  12. package/android/src/main/java/com/ReactNativeBlobUtil/ReactNativeBlobUtilProgressConfig.java +39 -39
  13. package/android/src/main/java/com/ReactNativeBlobUtil/ReactNativeBlobUtilReq.java +1092 -1092
  14. package/android/src/main/java/com/ReactNativeBlobUtil/Response/ReactNativeBlobUtilDefaultResp.java +98 -98
  15. package/android/src/main/java/com/ReactNativeBlobUtil/Response/ReactNativeBlobUtilFileResp.java +166 -166
  16. package/android/src/main/java/com/ReactNativeBlobUtil/Utils/FileDescription.java +19 -19
  17. package/android/src/main/java/com/ReactNativeBlobUtil/Utils/FileProvider.java +4 -4
  18. package/android/src/main/java/com/ReactNativeBlobUtil/Utils/MimeType.java +70 -70
  19. package/android/src/main/java/com/ReactNativeBlobUtil/Utils/PathResolver.java +223 -223
  20. package/android/src/main/java/com/ReactNativeBlobUtil/Utils/Tls12SocketFactory.java +68 -68
  21. package/android/src/main/res/values/strings.xml +3 -3
  22. package/android/src/main/res/xml/provider_paths.xml +12 -12
  23. package/android.js +58 -58
  24. package/class/ReactNativeBlobUtilCanceledFetchError.js +9 -9
  25. package/class/ReactNativeBlobUtilFile.js +5 -5
  26. package/class/ReactNativeBlobUtilReadStream.js +84 -84
  27. package/class/ReactNativeBlobUtilSession.js +68 -68
  28. package/class/ReactNativeBlobUtilWriteStream.js +50 -50
  29. package/class/StatefulPromise.js +7 -7
  30. package/codegenSpecs/NativeBlobUtils.js +86 -86
  31. package/components/Fetch.onPress.js +10 -10
  32. package/components/Fetch.when.js +15 -15
  33. package/fetch.js +350 -350
  34. package/fs.js +480 -480
  35. package/index.d.ts +880 -880
  36. package/index.js +64 -64
  37. package/index.js.flow +192 -192
  38. package/index.web.js +1 -1
  39. package/ios/PrivacyInfo.xcprivacy +28 -28
  40. package/ios/ReactNativeBlobUtil/ReactNativeBlobUtil.h +55 -55
  41. package/ios/ReactNativeBlobUtil/ReactNativeBlobUtil.mm +1013 -1013
  42. package/ios/ReactNativeBlobUtil.xcodeproj/project.pbxproj +405 -405
  43. package/ios/ReactNativeBlobUtilConst.h +58 -58
  44. package/ios/ReactNativeBlobUtilConst.mm +47 -47
  45. package/ios/ReactNativeBlobUtilFS.h +108 -108
  46. package/ios/ReactNativeBlobUtilFS.mm +1080 -1080
  47. package/ios/ReactNativeBlobUtilFileTransformer.h +23 -23
  48. package/ios/ReactNativeBlobUtilFileTransformer.mm +20 -20
  49. package/ios/ReactNativeBlobUtilNetwork.h +49 -49
  50. package/ios/ReactNativeBlobUtilNetwork.mm +159 -159
  51. package/ios/ReactNativeBlobUtilProgress.h +32 -32
  52. package/ios/ReactNativeBlobUtilProgress.mm +57 -57
  53. package/ios/ReactNativeBlobUtilReqBuilder.h +37 -37
  54. package/ios/ReactNativeBlobUtilReqBuilder.mm +292 -292
  55. package/ios/ReactNativeBlobUtilRequest.h +48 -48
  56. package/ios/ReactNativeBlobUtilRequest.mm +584 -584
  57. package/ios.js +61 -61
  58. package/json-stream.js +42 -42
  59. package/lib/oboe-browser.js +2703 -2703
  60. package/mediacollection.js +36 -36
  61. package/package.json +77 -77
  62. package/polyfill/Blob.js +362 -362
  63. package/polyfill/Event.js +11 -11
  64. package/polyfill/EventTarget.js +78 -78
  65. package/polyfill/Fetch.js +219 -219
  66. package/polyfill/File.js +27 -27
  67. package/polyfill/FileReader.js +91 -91
  68. package/polyfill/ProgressEvent.js +32 -32
  69. package/polyfill/XMLHttpRequest.js +466 -466
  70. package/polyfill/XMLHttpRequestEventTarget.js +126 -126
  71. package/polyfill/index.js +11 -11
  72. package/react-native-blob-util.podspec +48 -48
  73. package/types.js +69 -69
  74. package/utils/log.js +40 -40
  75. package/utils/unicode.js +7 -7
  76. package/utils/uri.js +33 -33
  77. package/utils/uuid.js +4 -4
  78. package/windows/ExperimentalFeatures.props +33 -33
  79. package/windows/README.md +2 -2
  80. package/windows/ReactNativeBlobUtil/PropertySheet.props +15 -15
  81. package/windows/ReactNativeBlobUtil/ReactNativeBlobUtil.cpp +1836 -1836
  82. package/windows/ReactNativeBlobUtil/ReactNativeBlobUtil.def +3 -3
  83. package/windows/ReactNativeBlobUtil/ReactNativeBlobUtil.h +372 -372
  84. package/windows/ReactNativeBlobUtil/ReactNativeBlobUtil.vcxproj +139 -139
  85. package/windows/ReactNativeBlobUtil/ReactNativeBlobUtil.vcxproj.filters +43 -43
  86. package/windows/ReactNativeBlobUtil/ReactPackageProvider.cpp +20 -20
  87. package/windows/ReactNativeBlobUtil/ReactPackageProvider.h +24 -24
  88. package/windows/ReactNativeBlobUtil/ReactPackageProvider.idl +9 -9
  89. package/windows/ReactNativeBlobUtil/codegen/.clang-format +1 -1
  90. package/windows/ReactNativeBlobUtil/codegen/NativeBlobUtilsDataTypes.g.h +42 -42
  91. package/windows/ReactNativeBlobUtil/codegen/NativeBlobUtilsSpec.g.h +353 -353
  92. package/windows/ReactNativeBlobUtil/packages.config +3 -3
  93. package/windows/ReactNativeBlobUtil/packages.lock.json +59 -59
  94. package/windows/ReactNativeBlobUtil/pch.cpp +1 -1
  95. package/windows/ReactNativeBlobUtil/pch.h +30 -30
  96. package/windows/ReactNativeBlobUtil/resource.h +5 -5
  97. package/windows/ReactNativeBlobUtil/targetver.h +8 -8
  98. package/windows/ReactNativeBlobUtil.sln +43 -43
package/index.js CHANGED
@@ -1,64 +1,64 @@
1
- // Copyright 2016 wkh237@github. All rights reserved.
2
- // Use of this source code is governed by a MIT-style license that can be
3
- // found in the LICENSE file.
4
-
5
- import ReactNativeBlobUtil from './codegenSpecs/NativeBlobUtils';
6
-
7
- //import StatefulPromise from './class/StatefulPromise.js'
8
- import fs from './fs';
9
- import MediaCollection from './mediacollection';
10
- import base64 from 'base-64';
11
- import polyfill from './polyfill';
12
- import android from './android';
13
- import ios from './ios';
14
- import JSONStream from './json-stream';
15
- import {config, fetch} from './fetch';
16
- import URIUtil from './utils/uri';
17
- import CanceledFetchError from './class/ReactNativeBlobUtilCanceledFetchError';
18
-
19
- const {
20
- ReactNativeBlobUtilSession,
21
- readStream,
22
- createFile,
23
- unlink,
24
- exists,
25
- mkdir,
26
- session,
27
- writeStream,
28
- readFile,
29
- ls,
30
- isDir,
31
- mv,
32
- cp
33
- } = fs;
34
-
35
- const Blob = polyfill.Blob;
36
- const wrap = URIUtil.wrap;
37
-
38
- // Show warning if native module not detected
39
- if (!ReactNativeBlobUtil || !ReactNativeBlobUtil.fetchBlobForm || !ReactNativeBlobUtil.fetchBlob) {
40
- console.warn(
41
- 'react-native-blob-util could not find valid native module.',
42
- 'please make sure you have linked native modules using `rnpm link`,',
43
- 'and restart RN packager or manually compile IOS/Android project.'
44
- );
45
- }
46
-
47
- export {ReactNativeBlobUtilConfig, ReactNativeBlobUtilResponseInfo, ReactNativeBlobUtilStream} from './types';
48
- export { URIUtil } from './utils/uri';
49
- export {FetchBlobResponse} from './class/ReactNativeBlobUtilBlobResponse';
50
- export { getUUID } from './utils/uuid';
51
- export default {
52
- fetch,
53
- base64,
54
- android,
55
- ios,
56
- config,
57
- session,
58
- fs,
59
- wrap,
60
- polyfill,
61
- JSONStream,
62
- MediaCollection,
63
- CanceledFetchError
64
- };
1
+ // Copyright 2016 wkh237@github. All rights reserved.
2
+ // Use of this source code is governed by a MIT-style license that can be
3
+ // found in the LICENSE file.
4
+
5
+ import ReactNativeBlobUtil from './codegenSpecs/NativeBlobUtils';
6
+
7
+ //import StatefulPromise from './class/StatefulPromise.js'
8
+ import fs from './fs';
9
+ import MediaCollection from './mediacollection';
10
+ import base64 from 'base-64';
11
+ import polyfill from './polyfill';
12
+ import android from './android';
13
+ import ios from './ios';
14
+ import JSONStream from './json-stream';
15
+ import {config, fetch} from './fetch';
16
+ import URIUtil from './utils/uri';
17
+ import CanceledFetchError from './class/ReactNativeBlobUtilCanceledFetchError';
18
+
19
+ const {
20
+ ReactNativeBlobUtilSession,
21
+ readStream,
22
+ createFile,
23
+ unlink,
24
+ exists,
25
+ mkdir,
26
+ session,
27
+ writeStream,
28
+ readFile,
29
+ ls,
30
+ isDir,
31
+ mv,
32
+ cp
33
+ } = fs;
34
+
35
+ const Blob = polyfill.Blob;
36
+ const wrap = URIUtil.wrap;
37
+
38
+ // Show warning if native module not detected
39
+ if (!ReactNativeBlobUtil || !ReactNativeBlobUtil.fetchBlobForm || !ReactNativeBlobUtil.fetchBlob) {
40
+ console.warn(
41
+ 'react-native-blob-util could not find valid native module.',
42
+ 'please make sure you have linked native modules using `rnpm link`,',
43
+ 'and restart RN packager or manually compile IOS/Android project.'
44
+ );
45
+ }
46
+
47
+ export {ReactNativeBlobUtilConfig, ReactNativeBlobUtilResponseInfo, ReactNativeBlobUtilStream} from './types';
48
+ export { URIUtil } from './utils/uri';
49
+ export {FetchBlobResponse} from './class/ReactNativeBlobUtilBlobResponse';
50
+ export { getUUID } from './utils/uuid';
51
+ export default {
52
+ fetch,
53
+ base64,
54
+ android,
55
+ ios,
56
+ config,
57
+ session,
58
+ fs,
59
+ wrap,
60
+ polyfill,
61
+ JSONStream,
62
+ MediaCollection,
63
+ CanceledFetchError
64
+ };
package/index.js.flow CHANGED
@@ -1,192 +1,192 @@
1
- // @flow strict
2
-
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>;
9
- }
10
-
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>;
28
- }
29
-
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>;
55
- }
56
-
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>;
61
- }
62
-
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;
73
- }
74
-
75
- declare class ReactNativeBlobUtilSession {
76
- static getSession(name: string): ReactNativeBlobUtilSession;
77
- static removeSession(name: string): void;
78
- static setSession(name: string, val: ReactNativeBlobUtilSession): void;
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;
86
- }
87
-
88
- declare class ReactNativeBlobUtilWriteStream {
89
- append: boolean;
90
- encoding: string;
91
- id: string;
92
- close(): void;
93
- write(data: string): Promise<void>;
94
- }
95
-
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;
105
- }
106
-
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>;
113
- }
114
-
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,
123
- storeLocal: boolean
124
- };
125
- export type AndroidDownloadOption = {
126
- description?: string,
127
- mime?: string,
128
- path: string,
129
- showNotification?: boolean,
130
- title?: string
131
- };
132
- export type AndroidFsStat = {
133
- external_free: number,
134
- external_total: number,
135
- internal_free: number,
136
- internal_total: number
137
- };
138
- export type Dirs = {
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
150
- };
151
- export type Encoding = "utf8" | "ascii" | "base64";
152
- export type FormField = { data: string, filename?: string, name: string, type?: string };
153
- export type HashAlgorithm = "md5" | "sha1" | "sha224" | "sha256" | "sha384" | "sha512";
154
- export type IosFsStat = { free: number, total: number };
155
- export type Methods = "POST" | "GET" | "DELETE" | "PUT" | "post" | "get" | "delete" | "put";
156
- export type ProgressCallback = (received: number, total: number) => void;
157
- export type ReactNativeBlobUtilConfig = {
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
172
- };
173
- export type ReactNativeBlobUtilResponseInfo = {
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
182
- };
183
- export type ReactNativeBlobUtilStat = {
184
- filename: string,
185
- lastModified: number,
186
- path: string,
187
- size: number,
188
- type: "directory" | "file" | "asset"
189
- };
190
- export type UploadProgressCallback = (sent: number, total: number) => void;
191
-
192
- declare export default ReactNativeBlobUtil;
1
+ // @flow strict
2
+
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>;
9
+ }
10
+
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>;
28
+ }
29
+
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>;
55
+ }
56
+
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>;
61
+ }
62
+
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;
73
+ }
74
+
75
+ declare class ReactNativeBlobUtilSession {
76
+ static getSession(name: string): ReactNativeBlobUtilSession;
77
+ static removeSession(name: string): void;
78
+ static setSession(name: string, val: ReactNativeBlobUtilSession): void;
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;
86
+ }
87
+
88
+ declare class ReactNativeBlobUtilWriteStream {
89
+ append: boolean;
90
+ encoding: string;
91
+ id: string;
92
+ close(): void;
93
+ write(data: string): Promise<void>;
94
+ }
95
+
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;
105
+ }
106
+
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>;
113
+ }
114
+
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,
123
+ storeLocal: boolean
124
+ };
125
+ export type AndroidDownloadOption = {
126
+ description?: string,
127
+ mime?: string,
128
+ path: string,
129
+ showNotification?: boolean,
130
+ title?: string
131
+ };
132
+ export type AndroidFsStat = {
133
+ external_free: number,
134
+ external_total: number,
135
+ internal_free: number,
136
+ internal_total: number
137
+ };
138
+ export type Dirs = {
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
150
+ };
151
+ export type Encoding = "utf8" | "ascii" | "base64";
152
+ export type FormField = { data: string, filename?: string, name: string, type?: string };
153
+ export type HashAlgorithm = "md5" | "sha1" | "sha224" | "sha256" | "sha384" | "sha512";
154
+ export type IosFsStat = { free: number, total: number };
155
+ export type Methods = "POST" | "GET" | "DELETE" | "PUT" | "post" | "get" | "delete" | "put";
156
+ export type ProgressCallback = (received: number, total: number) => void;
157
+ export type ReactNativeBlobUtilConfig = {
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
172
+ };
173
+ export type ReactNativeBlobUtilResponseInfo = {
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
182
+ };
183
+ export type ReactNativeBlobUtilStat = {
184
+ filename: string,
185
+ lastModified: number,
186
+ path: string,
187
+ size: number,
188
+ type: "directory" | "file" | "asset"
189
+ };
190
+ export type UploadProgressCallback = (sent: number, total: number) => void;
191
+
192
+ declare export default ReactNativeBlobUtil;
package/index.web.js CHANGED
@@ -1 +1 @@
1
- export default {};
1
+ export default {};
@@ -1,28 +1,28 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3
- <plist version="1.0">
4
- <dict>
5
- <key>NSPrivacyCollectedDataTypes</key>
6
- <array/>
7
- <key>NSPrivacyAccessedAPITypes</key>
8
- <array>
9
- <dict>
10
- <key>NSPrivacyAccessedAPIType</key>
11
- <string>NSPrivacyAccessedAPICategoryDiskSpace</string>
12
- <key>NSPrivacyAccessedAPITypeReasons</key>
13
- <array>
14
- <string>85F4.1</string>
15
- <string>E174.1</string>
16
- </array>
17
- </dict>
18
- <dict>
19
- <key>NSPrivacyAccessedAPIType</key>
20
- <string>NSPrivacyAccessedAPICategoryFileTimestamp</string>
21
- <key>NSPrivacyAccessedAPITypeReasons</key>
22
- <array>
23
- <string>0A2A.1</string>
24
- </array>
25
- </dict>
26
- </array>
27
- </dict>
28
- </plist>
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3
+ <plist version="1.0">
4
+ <dict>
5
+ <key>NSPrivacyCollectedDataTypes</key>
6
+ <array/>
7
+ <key>NSPrivacyAccessedAPITypes</key>
8
+ <array>
9
+ <dict>
10
+ <key>NSPrivacyAccessedAPIType</key>
11
+ <string>NSPrivacyAccessedAPICategoryDiskSpace</string>
12
+ <key>NSPrivacyAccessedAPITypeReasons</key>
13
+ <array>
14
+ <string>85F4.1</string>
15
+ <string>E174.1</string>
16
+ </array>
17
+ </dict>
18
+ <dict>
19
+ <key>NSPrivacyAccessedAPIType</key>
20
+ <string>NSPrivacyAccessedAPICategoryFileTimestamp</string>
21
+ <key>NSPrivacyAccessedAPITypeReasons</key>
22
+ <array>
23
+ <string>0A2A.1</string>
24
+ </array>
25
+ </dict>
26
+ </array>
27
+ </dict>
28
+ </plist>