How to read file as binary?


I am trying to integrate dropbox upload to my app for audio files. This requires the upload of binary files.

For iOS I can use the following:

        const soundObject = new Audio.Sound();
        const audio = await soundObject.loadAsync({
            uri: file
        const response = await fetch('', {
          method: 'POST',
          headers: {
            Accept: 'application/json',
            'Authorization': 'Bearer API-TOKEN',
            'Dropbox-API-Arg': `{"path": "/recordings/file.wav","mode": "overwrite","autorename": true,"mute": false,"strict_conflict": false}`,
            'Content-Type': 'application/octet-stream'
          body: audio,
        const json = await response.json();

However this is failing on android with a network error. I can’t use react-native-fs package so is there any other method go get around reading files as string?

const fileBase64 = await FileSystem.readAsStringAsync(fileUri , {
     encoding: FileSystem.EncodingType.Base64,

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.