I'm uploading media files (images, wav files) from my phone to AWS S3 bucket. To upload to S3, finally I'll need the Byte array.
I'm using react-native-fs package and reading in base64, and then decoding it back to byteArray and then finally uploading it AWS S3
Currently, I'm doing the following,
let base64Data = await RNFS.readFile(fPath, 'base64');
const arrayBuffer = AWS.util.base64.decode(base64Data)
I'm trying to find a way to avoid the base64.decode() operation.
The Documentation of RNFS.readFile() here says,
encoding can be one of utf8 (default), ascii, base64. Use base64 for reading binary files.
I also explored RNFetchBlob package and it uses the same encoding as above and I couldn't find any support for reading raw bytes in RNFetchBlob as well.
Question: Is there a way to directly read raw bytes from the file using react-native-fs package or any other React Native package?
Thank you.