1<!DOCTYPE html> 2<meta charset="utf-8"> 3<title>FileAPI Test: filereader_readAsBinaryString</title> 4<link rel="author" title="Intel" href="http://www.intel.com"> 5<link rel="help" href="https://w3c.github.io/FileAPI/#readAsBinaryString"> 6<script src="/resources/testharness.js"></script> 7<script src="/resources/testharnessreport.js"></script> 8<script> 9 10async_test(t => { 11 const blob = new Blob(["σ"]); 12 const reader = new FileReader(); 13 14 reader.onload = t.step_func_done(() => { 15 assert_equals(typeof reader.result, "string", "The result is string"); 16 assert_equals(reader.result.length, 2, "The result length is 2"); 17 assert_equals(reader.result, "\xcf\x83", "The result is \xcf\x83"); 18 assert_equals(reader.readyState, reader.DONE); 19 }); 20 21 reader.onloadstart = t.step_func(() => { 22 assert_equals(reader.readyState, reader.LOADING); 23 }); 24 25 reader.onprogress = t.step_func(() => { 26 assert_equals(reader.readyState, reader.LOADING); 27 }); 28 29 reader.readAsBinaryString(blob); 30}); 31 32</script> 33