@uploadcare/upload-client 6.1.0-alpha.1 → 6.1.0
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/README.md +28 -1
- package/dist/index.browser.js +1 -1
- package/dist/index.node.js +1 -1
- package/dist/index.react-native.js +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -430,6 +430,8 @@ See [docs][uc-file-metadata] and [REST API][uc-docs-metadata] for details.
|
|
|
430
430
|
|
|
431
431
|
## React Native
|
|
432
432
|
|
|
433
|
+
### Prepare
|
|
434
|
+
|
|
433
435
|
To be able to use `@uploadcare/upload-client` with React Native, you need to
|
|
434
436
|
install [react-native-url-polyfill][react-native-url-polyfill].
|
|
435
437
|
|
|
@@ -437,6 +439,27 @@ To prevent [`Error: Cannot create URL for blob`][react-native-url-polyfill-issue
|
|
|
437
439
|
errors you need to configure your Android app schema to accept blobs -
|
|
438
440
|
have a look at this pull request for an example: [5985d7e][react-native-url-polyfill-example].
|
|
439
441
|
|
|
442
|
+
1. Add the following code to the `application` section of your `AndroidManifest.xml`:
|
|
443
|
+
|
|
444
|
+
```xml
|
|
445
|
+
<provider
|
|
446
|
+
android:name="com.facebook.react.modules.blob.BlobProvider"
|
|
447
|
+
android:authorities="@string/blob_provider_authority"
|
|
448
|
+
android:exported="false"
|
|
449
|
+
/>
|
|
450
|
+
```
|
|
451
|
+
|
|
452
|
+
2. Add the following code to the `android/app/src/main/res/values/strings.xml`:
|
|
453
|
+
|
|
454
|
+
```xml
|
|
455
|
+
<resources>
|
|
456
|
+
<string name="app_name">MY_REACT_NATIVE_APP_NAME</string>
|
|
457
|
+
<string name="blob_provider_authority">com.detox.blob</string>
|
|
458
|
+
</resources>
|
|
459
|
+
```
|
|
460
|
+
|
|
461
|
+
### Usage
|
|
462
|
+
|
|
440
463
|
You can use `ReactNativeAsset` as an input to the `@uploadcare/upload-client` like this:
|
|
441
464
|
|
|
442
465
|
```ts
|
|
@@ -457,7 +480,11 @@ Or `Blob` like this:
|
|
|
457
480
|
```ts
|
|
458
481
|
const uri = 'URI_TO_FILE'
|
|
459
482
|
const blob = await fetch(uri).then((res) => res.blob())
|
|
460
|
-
uploadFile(blob, {
|
|
483
|
+
uploadFile(blob, {
|
|
484
|
+
publicKey: 'YOUR_PUBLIC_KEY',
|
|
485
|
+
fileName: 'file.txt',
|
|
486
|
+
contentType: 'text/plain'
|
|
487
|
+
})
|
|
461
488
|
```
|
|
462
489
|
|
|
463
490
|
## Testing
|
package/dist/index.browser.js
CHANGED
package/dist/index.node.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uploadcare/upload-client",
|
|
3
|
-
"version": "6.1.0
|
|
3
|
+
"version": "6.1.0",
|
|
4
4
|
"description": "Library for work with Uploadcare Upload API",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "./dist/index.node.js",
|
|
@@ -78,7 +78,7 @@
|
|
|
78
78
|
"koa-body": "5.0.0",
|
|
79
79
|
"mock-socket": "9.0.3",
|
|
80
80
|
"start-server-and-test": "1.14.0",
|
|
81
|
-
"@uploadcare/api-client-utils": "^6.
|
|
81
|
+
"@uploadcare/api-client-utils": "^6.1.0",
|
|
82
82
|
"chalk": "^4.1.2"
|
|
83
83
|
},
|
|
84
84
|
"dependencies": {
|