Dateileser mit Versprechen

export const fileReader = (file: File) => {
    const reader = new FileReader();

    if(!file) return;

    return new Promise((resolve, reject) => {
        reader.onerror = () => {
            reader.abort();
            reject(new DOMException("Problem parsing input file."));
        }

        reader.readAsDataURL(file);
        reader.onload = (e) => {
            resolve(e.target?.result);
        }
    })
}
Lucas Juan