[Edit]
+
0
-
0
JavaScript - convert blob to text (from UTF-8 bytes)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20const readText = async (blob) => { return new Promise((resolve, reject) => { const reader = new FileReader(); reader.onload = () => resolve(reader.result); reader.onerror = () => reject('Incorrect blob or file object.'); reader.readAsText(blob, 'UTF-8'); }); }; // Usage example: const blob = ... // Hint: File is Blob so we can convert read file as text. const text = await readText(blob); // See also: // // 1. https://dirask.com/snippets/JavaScript-convert-text-to-Blob-text-plain-and-UTF-8-encoding-DlBN4j