Web APIs

File inherited text()

Try the free JavaScript compiler

Reads File bytes as UTF-8 text using the inherited Blob method.

Formal Syntax & Structure

javascript syntaxjavascript
file.text()

Return Value

Promise<string>

Reads File bytes as UTF-8 text using the inherited Blob method.

Working Example

Example Snippetjavascript
(async () => {const f=new File(["hello"],"x.txt");console.log(f instanceof Blob,await f.text());})()
JavaScript Reference