react-native-blob-util 0.22.0 → 0.22.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.
- package/.eslintrc.js +56 -56
- package/LICENSE +21 -21
- package/Migration.md +41 -41
- package/NuGet.config +11 -11
- package/README.md +1109 -1104
- package/android/gradle.properties +1 -1
- package/android/src/main/AndroidManifest.xml +37 -37
- package/android/src/main/java/com/ReactNativeBlobUtil/ReactNativeBlobUtilConfig.java +57 -57
- package/android/src/main/java/com/ReactNativeBlobUtil/ReactNativeBlobUtilConst.java +20 -20
- package/android/src/main/java/com/ReactNativeBlobUtil/ReactNativeBlobUtilFileTransformer.java +9 -9
- package/android/src/main/java/com/ReactNativeBlobUtil/ReactNativeBlobUtilImpl.java +431 -431
- package/android/src/main/java/com/ReactNativeBlobUtil/ReactNativeBlobUtilProgressConfig.java +39 -39
- package/android/src/main/java/com/ReactNativeBlobUtil/ReactNativeBlobUtilReq.java +1014 -1014
- package/android/src/main/java/com/ReactNativeBlobUtil/Response/ReactNativeBlobUtilDefaultResp.java +98 -98
- package/android/src/main/java/com/ReactNativeBlobUtil/Response/ReactNativeBlobUtilFileResp.java +166 -166
- package/android/src/main/java/com/ReactNativeBlobUtil/Utils/FileDescription.java +19 -19
- package/android/src/main/java/com/ReactNativeBlobUtil/Utils/FileProvider.java +4 -4
- package/android/src/main/java/com/ReactNativeBlobUtil/Utils/MimeType.java +70 -70
- package/android/src/main/java/com/ReactNativeBlobUtil/Utils/PathResolver.java +223 -223
- package/android/src/main/java/com/ReactNativeBlobUtil/Utils/Tls12SocketFactory.java +68 -68
- package/android/src/main/res/values/strings.xml +3 -3
- package/android/src/main/res/xml/provider_paths.xml +12 -12
- package/android.js +58 -58
- package/class/ReactNativeBlobUtilCanceledFetchError.js +9 -9
- package/class/ReactNativeBlobUtilFile.js +5 -5
- package/class/ReactNativeBlobUtilReadStream.js +84 -84
- package/class/ReactNativeBlobUtilSession.js +68 -68
- package/class/ReactNativeBlobUtilWriteStream.js +50 -50
- package/class/StatefulPromise.js +7 -7
- package/codegenSpecs/NativeBlobUtils.js +86 -86
- package/components/Fetch.onPress.js +10 -10
- package/components/Fetch.when.js +15 -15
- package/fetch.js +350 -350
- package/fs.js +480 -480
- package/index.js +64 -64
- package/index.js.flow +192 -192
- package/index.web.js +1 -1
- package/ios/PrivacyInfo.xcprivacy +28 -28
- package/ios/ReactNativeBlobUtil/ReactNativeBlobUtil.h +55 -55
- package/ios/ReactNativeBlobUtil/ReactNativeBlobUtil.mm +992 -992
- package/ios/ReactNativeBlobUtil.xcodeproj/project.pbxproj +405 -405
- package/ios/ReactNativeBlobUtilConst.h +58 -58
- package/ios/ReactNativeBlobUtilConst.mm +47 -47
- package/ios/ReactNativeBlobUtilFS.h +108 -108
- package/ios/ReactNativeBlobUtilFS.mm +1064 -1064
- package/ios/ReactNativeBlobUtilFileTransformer.h +23 -23
- package/ios/ReactNativeBlobUtilFileTransformer.mm +20 -20
- package/ios/ReactNativeBlobUtilNetwork.h +49 -49
- package/ios/ReactNativeBlobUtilNetwork.mm +159 -159
- package/ios/ReactNativeBlobUtilProgress.h +32 -32
- package/ios/ReactNativeBlobUtilProgress.mm +57 -57
- package/ios/ReactNativeBlobUtilReqBuilder.h +37 -37
- package/ios/ReactNativeBlobUtilReqBuilder.mm +292 -292
- package/ios/ReactNativeBlobUtilRequest.h +48 -48
- package/ios/ReactNativeBlobUtilRequest.mm +584 -584
- package/ios.js +61 -61
- package/json-stream.js +42 -42
- package/lib/oboe-browser.js +2703 -2703
- package/mediacollection.js +36 -36
- package/package.json +68 -68
- package/polyfill/Blob.js +362 -362
- package/polyfill/Event.js +11 -11
- package/polyfill/EventTarget.js +78 -78
- package/polyfill/Fetch.js +219 -219
- package/polyfill/File.js +27 -27
- package/polyfill/FileReader.js +91 -91
- package/polyfill/ProgressEvent.js +32 -32
- package/polyfill/XMLHttpRequest.js +466 -466
- package/polyfill/XMLHttpRequestEventTarget.js +126 -126
- package/polyfill/index.js +11 -11
- package/react-native-blob-util.podspec +48 -48
- package/types.js +69 -69
- package/utils/log.js +40 -40
- package/utils/unicode.js +7 -7
- package/utils/uri.js +33 -33
- package/utils/uuid.js +4 -4
- package/windows/ExperimentalFeatures.props +33 -33
- package/windows/README.md +2 -2
- package/windows/ReactNativeBlobUtil/PropertySheet.props +15 -15
- package/windows/ReactNativeBlobUtil/ReactNativeBlobUtil.cpp +1836 -1836
- package/windows/ReactNativeBlobUtil/ReactNativeBlobUtil.def +3 -3
- package/windows/ReactNativeBlobUtil/ReactNativeBlobUtil.h +372 -372
- package/windows/ReactNativeBlobUtil/ReactNativeBlobUtil.vcxproj +139 -139
- package/windows/ReactNativeBlobUtil/ReactNativeBlobUtil.vcxproj.filters +43 -43
- package/windows/ReactNativeBlobUtil/ReactPackageProvider.cpp +20 -20
- package/windows/ReactNativeBlobUtil/ReactPackageProvider.h +24 -24
- package/windows/ReactNativeBlobUtil/ReactPackageProvider.idl +9 -9
- package/windows/ReactNativeBlobUtil/codegen/.clang-format +1 -1
- package/windows/ReactNativeBlobUtil/codegen/NativeBlobUtilsDataTypes.g.h +42 -42
- package/windows/ReactNativeBlobUtil/codegen/NativeBlobUtilsSpec.g.h +353 -353
- package/windows/ReactNativeBlobUtil/packages.config +3 -3
- package/windows/ReactNativeBlobUtil/packages.lock.json +59 -59
- package/windows/ReactNativeBlobUtil/pch.cpp +1 -1
- package/windows/ReactNativeBlobUtil/pch.h +30 -30
- package/windows/ReactNativeBlobUtil/resource.h +5 -5
- package/windows/ReactNativeBlobUtil/targetver.h +8 -8
- package/windows/ReactNativeBlobUtil.sln +43 -43
package/ios.js
CHANGED
|
@@ -1,61 +1,61 @@
|
|
|
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 { Platform } from "react-native";
|
|
6
|
-
import ReactNativeBlobUtil from "./codegenSpecs/NativeBlobUtils";
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* Displays an options menu using UIDocumentInteractionController.presentOptionsMenu
|
|
10
|
-
* @param {string} path Path of the file to be open.
|
|
11
|
-
* @param {string} scheme URI scheme that needs to support, optional
|
|
12
|
-
* @return {Promise}
|
|
13
|
-
*/
|
|
14
|
-
function presentOptionsMenu(path: string, scheme: string) {
|
|
15
|
-
if (Platform.OS === "ios")
|
|
16
|
-
return ReactNativeBlobUtil.presentOptionsMenu("file://" + path, scheme);
|
|
17
|
-
else return Promise.reject("ReactNativeBlobUtil.openDocument only supports IOS.");
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* Displays a menu for opening the document using UIDocumentInteractionController.presentOpenInMenu
|
|
22
|
-
* @param {string} path Path of the file to be open.
|
|
23
|
-
* @param {string} scheme URI scheme that needs to support, optional
|
|
24
|
-
* @return {Promise}
|
|
25
|
-
*/
|
|
26
|
-
function presentOpenInMenu(path: string, scheme: string) {
|
|
27
|
-
if (Platform.OS === "ios")
|
|
28
|
-
return ReactNativeBlobUtil.presentOpenInMenu("file://" + path, scheme);
|
|
29
|
-
else return Promise.reject("ReactNativeBlobUtil.openDocument only supports IOS.");
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
* Displays a full-screen preview of the target document using UIDocumentInteractionController.presentPreview
|
|
34
|
-
* @param {string} path Path of the file to be open.
|
|
35
|
-
* @param {string} scheme URI scheme that needs to support, optional
|
|
36
|
-
* @return {Promise}
|
|
37
|
-
*/
|
|
38
|
-
function presentPreview(path: string, scheme: string) {
|
|
39
|
-
if (Platform.OS === "ios")
|
|
40
|
-
return ReactNativeBlobUtil.presentPreview("file://" + path, scheme);
|
|
41
|
-
else return Promise.reject("ReactNativeBlobUtil.previewDocument only supports IOS.");
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
/**
|
|
45
|
-
* Set excludeFromBackupKey to a URL to prevent the resource to be backuped to
|
|
46
|
-
* iCloud.
|
|
47
|
-
* @param {string} url URL of the resource, only file URL is supported
|
|
48
|
-
* @return {Promise}
|
|
49
|
-
*/
|
|
50
|
-
function excludeFromBackupKey(path: string) {
|
|
51
|
-
return ReactNativeBlobUtil.excludeFromBackupKey("file://" + path);
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
export default {
|
|
55
|
-
presentPreview,
|
|
56
|
-
openDocument: presentPreview, // legacy alias
|
|
57
|
-
presentOptionsMenu,
|
|
58
|
-
previewDocument: presentOptionsMenu, // legacy alias
|
|
59
|
-
presentOpenInMenu,
|
|
60
|
-
excludeFromBackupKey
|
|
61
|
-
};
|
|
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 { Platform } from "react-native";
|
|
6
|
+
import ReactNativeBlobUtil from "./codegenSpecs/NativeBlobUtils";
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Displays an options menu using UIDocumentInteractionController.presentOptionsMenu
|
|
10
|
+
* @param {string} path Path of the file to be open.
|
|
11
|
+
* @param {string} scheme URI scheme that needs to support, optional
|
|
12
|
+
* @return {Promise}
|
|
13
|
+
*/
|
|
14
|
+
function presentOptionsMenu(path: string, scheme: string) {
|
|
15
|
+
if (Platform.OS === "ios")
|
|
16
|
+
return ReactNativeBlobUtil.presentOptionsMenu("file://" + path, scheme);
|
|
17
|
+
else return Promise.reject("ReactNativeBlobUtil.openDocument only supports IOS.");
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Displays a menu for opening the document using UIDocumentInteractionController.presentOpenInMenu
|
|
22
|
+
* @param {string} path Path of the file to be open.
|
|
23
|
+
* @param {string} scheme URI scheme that needs to support, optional
|
|
24
|
+
* @return {Promise}
|
|
25
|
+
*/
|
|
26
|
+
function presentOpenInMenu(path: string, scheme: string) {
|
|
27
|
+
if (Platform.OS === "ios")
|
|
28
|
+
return ReactNativeBlobUtil.presentOpenInMenu("file://" + path, scheme);
|
|
29
|
+
else return Promise.reject("ReactNativeBlobUtil.openDocument only supports IOS.");
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Displays a full-screen preview of the target document using UIDocumentInteractionController.presentPreview
|
|
34
|
+
* @param {string} path Path of the file to be open.
|
|
35
|
+
* @param {string} scheme URI scheme that needs to support, optional
|
|
36
|
+
* @return {Promise}
|
|
37
|
+
*/
|
|
38
|
+
function presentPreview(path: string, scheme: string) {
|
|
39
|
+
if (Platform.OS === "ios")
|
|
40
|
+
return ReactNativeBlobUtil.presentPreview("file://" + path, scheme);
|
|
41
|
+
else return Promise.reject("ReactNativeBlobUtil.previewDocument only supports IOS.");
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Set excludeFromBackupKey to a URL to prevent the resource to be backuped to
|
|
46
|
+
* iCloud.
|
|
47
|
+
* @param {string} url URL of the resource, only file URL is supported
|
|
48
|
+
* @return {Promise}
|
|
49
|
+
*/
|
|
50
|
+
function excludeFromBackupKey(path: string) {
|
|
51
|
+
return ReactNativeBlobUtil.excludeFromBackupKey("file://" + path);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export default {
|
|
55
|
+
presentPreview,
|
|
56
|
+
openDocument: presentPreview, // legacy alias
|
|
57
|
+
presentOptionsMenu,
|
|
58
|
+
previewDocument: presentOptionsMenu, // legacy alias
|
|
59
|
+
presentOpenInMenu,
|
|
60
|
+
excludeFromBackupKey
|
|
61
|
+
};
|
package/json-stream.js
CHANGED
|
@@ -1,42 +1,42 @@
|
|
|
1
|
-
import Oboe from './lib/oboe-browser.min.js';
|
|
2
|
-
import XMLHttpRequest from './polyfill/XMLHttpRequest';
|
|
3
|
-
import URIUtil from './utils/uri';
|
|
4
|
-
|
|
5
|
-
const OboeExtended = (arg: string | Object) => {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
window.location = '';
|
|
9
|
-
|
|
10
|
-
if (!window.XMLHttpRequest.isRNFBPolyfill) {
|
|
11
|
-
window.XMLHttpRequest = XMLHttpRequest;
|
|
12
|
-
console.warn(
|
|
13
|
-
'Use JSONStream will automatically replace window.XMLHttpRequest with ReactNativeBlobUtil.polyfill.XMLHttpRequest. ' +
|
|
14
|
-
'You are seeing this warning because you did not replace it manually.'
|
|
15
|
-
);
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
if (typeof arg === 'string') {
|
|
19
|
-
if (URIUtil.isFileURI(arg)) {
|
|
20
|
-
arg = {
|
|
21
|
-
url: 'JSONStream://' + arg,
|
|
22
|
-
headers: {noCache: true}
|
|
23
|
-
};
|
|
24
|
-
}
|
|
25
|
-
else
|
|
26
|
-
arg = 'JSONStream://' + arg;
|
|
27
|
-
|
|
28
|
-
}
|
|
29
|
-
else if (typeof arg === 'object') {
|
|
30
|
-
let headers = arg.headers || {};
|
|
31
|
-
if (URIUtil.isFileURI(arg.url)) {
|
|
32
|
-
headers.noCache = true;
|
|
33
|
-
}
|
|
34
|
-
arg = Object.assign(arg, {
|
|
35
|
-
url: 'JSONStream://' + arg.url,
|
|
36
|
-
headers
|
|
37
|
-
});
|
|
38
|
-
}
|
|
39
|
-
return Oboe(arg);
|
|
40
|
-
};
|
|
41
|
-
|
|
42
|
-
export default OboeExtended;
|
|
1
|
+
import Oboe from './lib/oboe-browser.min.js';
|
|
2
|
+
import XMLHttpRequest from './polyfill/XMLHttpRequest';
|
|
3
|
+
import URIUtil from './utils/uri';
|
|
4
|
+
|
|
5
|
+
const OboeExtended = (arg: string | Object) => {
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
window.location = '';
|
|
9
|
+
|
|
10
|
+
if (!window.XMLHttpRequest.isRNFBPolyfill) {
|
|
11
|
+
window.XMLHttpRequest = XMLHttpRequest;
|
|
12
|
+
console.warn(
|
|
13
|
+
'Use JSONStream will automatically replace window.XMLHttpRequest with ReactNativeBlobUtil.polyfill.XMLHttpRequest. ' +
|
|
14
|
+
'You are seeing this warning because you did not replace it manually.'
|
|
15
|
+
);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
if (typeof arg === 'string') {
|
|
19
|
+
if (URIUtil.isFileURI(arg)) {
|
|
20
|
+
arg = {
|
|
21
|
+
url: 'JSONStream://' + arg,
|
|
22
|
+
headers: {noCache: true}
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
else
|
|
26
|
+
arg = 'JSONStream://' + arg;
|
|
27
|
+
|
|
28
|
+
}
|
|
29
|
+
else if (typeof arg === 'object') {
|
|
30
|
+
let headers = arg.headers || {};
|
|
31
|
+
if (URIUtil.isFileURI(arg.url)) {
|
|
32
|
+
headers.noCache = true;
|
|
33
|
+
}
|
|
34
|
+
arg = Object.assign(arg, {
|
|
35
|
+
url: 'JSONStream://' + arg.url,
|
|
36
|
+
headers
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
return Oboe(arg);
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
export default OboeExtended;
|