trying to create a base64 string from a wav file in react-native to store on server

Viewed 1208

The react-native-audio-record NPM library uses Buffer to create an array of blob chunks, as well as a complete wav file locally to the phone. I can either use the wav file itself, or concatenate the base64 chunks to one string (of course, the chunks need to processed to remove the base64 padding from each chunk). Can I create a single base64 string directly from the wav file?

1 Answers

You have uri(path) of recorded audio . You can use react-native-fs to convert wav file to base64

try this

import { readFile } from "react-native-fs";

async function getUriToBase64(uri) {
  const base64String = await readFile(uri, "base64");
  return base64String
}
Related