Update fnTools.ts

This commit is contained in:
Andros Fenollosa 2022-02-10 09:39:47 +01:00 committed by GitHub
parent e5f56a052d
commit e28171eefc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -213,3 +213,15 @@ export function arraySwapIndex(firstIndex: number, secondIndex: number, list: Ar
tempList[secondIndex] = tmpFirstPos; tempList[secondIndex] = tmpFirstPos;
return tempList; return tempList;
} }
/**
* Returns a File in text.
* @param {File} file
* @return {Promise<string>}
*/
export async function encodeFileToText(file: File): Promise<string> {
return file.text().then((text) => {
return text;
});
}