File size: 326 Bytes
899d9c6 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
export function fileToDataURL(file: File): Promise<string> {
return new Promise((resolve, reject) => {
const reader = new FileReader();
reader.onload = function (event) {
resolve(event.target?.result as string);
};
reader.onerror = function (error) {
reject(error);
};
reader.readAsDataURL(file);
});
}
|