Angular filereader base64 remove preceding data

与世无争的帅哥 提交于 2020-02-06 08:18:07

问题


In Angular, I'm converting blob to base64 FileReader. But I want to remove the data:application/octet-stream;base64, at the start.

  getRecordedAudio() {
    if (this.recordedAudio) {
      let fileReader = new FileReader();    
      fileReader.onloadend = function() {
        let base64data = fileReader.result;
        //base64data = base64data.split(',')[1]; ---> How can this be done?
        console.log('base64data-', base64data);
      };
      fileReader.readAsDataURL(this.recordedAudio);
    }
  }

How can I do this?

I'm getting error:

Property 'split' does not exist on type 'ArrayBuffer'.

来源:https://stackoverflow.com/questions/58473636/angular-filereader-base64-remove-preceding-data

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!