-
Notifications
You must be signed in to change notification settings - Fork 8.4k
Description
Environment
Expo CLI 2.3.8 environment info:
System:
OS: Windows 10
Binaries:
Yarn: 1.12.1 - C:\Users\Student\AppData\Roaming\npm\yarn.CMD
npm: 6.4.1 - C:\Users\Student\AppData\Roaming\npm\npm.CMD
IDEs:
Android Studio: Version 2.3.0.0 AI-162.4069837
Diagnostics report:
https://exp-xde-diagnostics.s3.amazonaws.com/emixis-82436675-9e02-4a6f-bb66-5660cf37149b.tar.gz
Steps to Reproduce
Call DocumentPicker.getDocumentAsync
then FileSystem.readAsStringAsync
to read the file as base64
const response: IDocumentPickerResponse = await DocumentPicker.getDocumentAsync({
copyToCacheDirectory: false,
type: '*/*',
});
const base64: string = await FileSystem.readAsStringAsync(
response.uri,
{
encoding: FileSystem.EncodingTypes.Base64,
});
console.log(base64.length);
Expected Behavior
My goal is to send the base64 to a server using webservices. I expected the base64 to be light enough to achieve that.
Actual Behavior
The base64 of a file that weights approx 3.9 Mo is 5 250 000 chars long (i can't even log it). When I try sending this to the server the request fails because the payload is too long.
Moreover, I'm getting this warning when saving it to redux:
The app even crashes when the size of the file exceeds approx 8 Mo. Logcat's stack trace can be found here https://justpaste.it/6ss56
Is there a way to reduce the base64's size ?