1
0
Fork 0
mirror of https://github.com/jellyfin/jellyfin-web synced 2025-03-30 19:56:21 +00:00

Preliminary Lyrics Editor

This commit is contained in:
LJQ 2024-04-22 20:09:27 +08:00 committed by Bill Thornton
parent 12ba71781e
commit 648e8ff2a6
11 changed files with 701 additions and 17 deletions

View file

@ -13,3 +13,18 @@ export function readFileAsBase64(file: File): Promise<string> {
reader.readAsDataURL(file);
});
}
/**
* Reads and returns the file in text format
*/
export function readFileAsText(file: File): Promise<string> {
return new Promise(function (resolve, reject) {
const reader = new FileReader();
reader.onload = (e) => {
const data = e.target?.result as string;
resolve(data);
};
reader.onerror = reject;
reader.readAsText(file);
});
}