Konversi file menjadi gumpalan di sudut

changeFile(file) {
    return new Promise((resolve, reject) => {
        const reader = new FileReader();
        reader.readAsDataURL(file);
        reader.onload = () => resolve(reader.result);
        reader.onerror = error => reject(error);
    });
}

uploadFile(event) {
    if (event.target.value) {
        const file = event.target.files[0];
        const type = file.type;
        this.changeFile(file).then((base64: string): any => {
            console.log(base64);
            this.fileBlob = this.b64Blob([base64], type);
            console.log(this.fileBlob)
        });
    } else alert('Nothing')
}
Filthy Fly