itinance / itinance/react-native-fs

Reading ByteArray (raw bytes) directly from file

Open
#1,194 3 comments 6 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
5k
Forks
1k
PR merge metrics
No merged PRs in 30d

Description

Hi, I'm uploading media files (images, wav files) from my phone to S3 bucket. To upload, I'll need the Byte array. Currently I'm reading in base64, and then decode it back to byteArray and then finally uploading it.

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 says,

`encoding can be one of utf8 (default), ascii, base64. Use base64 for reading binary files.`

**Question:** Is there a way to directly read raw bytes from the file?

Thank you.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.