ts base64 dari file

  convertFile(file: File): Observable<string> {
    const result = new ReplaySubject<string>(1);
    const reader = new FileReader();
    reader.readAsBinaryString(file);
    reader.onload = (event) => result.next(btoa(reader.result.toString()));
    return result;
  }
	
this.convertFile(event.target.files[0]).subscribe(base64 => {
	this.base64Output = base64;
});
/// NOTE ///
// The event.target.files is just the File Object e.g. from a
// <input type="file"> form
// you can also create a file with the following command:
var f = new File([""], "filename");


JBTheOneAndOnly