Comments (5)
Here is my further debugging
this is my uri file:///Users/transformhub/Library/Developer/CoreSimulator/Devices/6B91F341-3D64-4464-89EB-95A9071CCA3F/data/Containers/Data/Application/1CC49EE3-60ED-4AED-912B-FDA7FB3B1284/tmp/CA4139AE-C50F-4420-9EDB-95EFA6910B6D.jpg
this is my type image/jpg
const blobData = await ReactNativeBlobUtil.fetch('GET', uri!);
const blob = await blobData.blob(type!, 1024);
u
from react-native-blob-util.
facing exactly the same problem. Tried to readFile the image into base64 first but hasn't figured out how to convert base64 to blob. React Native 0.70. ReactNativeBlobUtil 0.19.6
Tried the code below but the response doesn't have a blob
const response = await ReactNativeBlobUtil
.config({ fileCache: true })
.fetch('GET', `data:${_contentType};base64,${_base64}`); //<< _base64 is the image data string in base64. _contentType is image/jpeg.
from react-native-blob-util.
Found a closed issue here: #297
Not sure if the solution (formData and XMLHttprequest by @RonRadtke) provided is working here as well.
from react-native-blob-util.
Here is the conversion working on my RN 0.70.x:
import {decode, encode} from 'base-64'; //<<==yarn add base-64 if not available
// Convert base64 to blob
function base64ToUint8Array(base64) {
try {
const binaryString = decode(base64); // Decode base64
const len = binaryString.length;
const bytes = new Uint8Array(len);
for (let i = 0; i < len; i++) {
bytes[i] = binaryString.charCodeAt(i);
}
return bytes; //<<==bytes is the blob which is to be used directly in fetch PUT
} catch (err) {
return null;
};
}
from react-native-blob-util.
@emclab Genius. Thank you
from react-native-blob-util.
Related Issues (20)
- File gets corrupted with readStream() with base64 when using bufferSize defaults
- java to kotlin change example HOT 5
- pathForAppGroup typescript error HOT 1
- Error opening APK file: installation package is corrupt HOT 3
- Integration network debugging react-native-debugger HOT 1
- Crash when readStream on IOS
- Problem with java.lang.RuntimeException: java.lang.IllegalStateException: Use of own trust manager but none defined HOT 1
- wifiOnly option doesn't work on iOS as expected
- copyToMediaStore does not work on Android versions lower than 10 HOT 2
- Upload Video [Error: The operation couldn’t be completed. Message too long] HOT 3
- [Error: Unexpected FileStorage response file: null] on android 14 HOT 1
- Run error in windows, due to the WindowsTargetPlatformMinVersion
- ReactNativeBlobUtil.fs does not work if path contains 'content://' HOT 1
- How to get access to assets file (issue opened after trouble shooting read). HOT 2
- Android 14 PDF Issues HOT 1
- Cancel Download function not working HOT 5
- Android: Native Crash App Issue "PDF renderer" HOT 1
- Jest Tests throw error Invariant Violation: `new NativeEventEmitter()` requires a non-null argument. HOT 1
- Android: Task :app:compileDebugJavaWithJavac FAILED HOT 1
- Is there a new release plan? HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-native-blob-util.