I want to achieve "new File()" JS function in React native, how can I do this?

Viewed 47

I want to upload an image file after encoding it , by implement "new File()" function that is shown in the given JS Code into react native, how can i achieve that?

dataURLtoFile() {
      mime = this.state.imageResponce.type,

    let bstr = atob(this.state.imageResponce.base64),
      n = bstr.length,
      u8arr = new Uint8Array(n);
   
    while (n--) {
      u8arr[n] = bstr.charCodeAt(n);
    }
    return new File([u8arr], fileName, { type: mime });
  }
0 Answers
Related