mirror of
https://github.com/koel/koel
synced 2024-12-25 20:13:06 +00:00
12 lines
335 B
TypeScript
12 lines
335 B
TypeScript
|
export const fileReader = {
|
||
|
/**
|
||
|
* Read a File into a binary string
|
||
|
*/
|
||
|
readAsDataUrl: (file: Blob) => new Promise<string>((resolve, reject): void => {
|
||
|
const reader = new FileReader()
|
||
|
reader.readAsDataURL(file)
|
||
|
reader.onload = () => resolve(<string>reader.result)
|
||
|
reader.onerror = error => reject(error)
|
||
|
})
|
||
|
}
|