MCPcopy Create free account
hub / github.com/aosabook/500lines / readFile

Function readFile

blockcode/code/file.js:51–59  ·  view source on GitHub ↗
(file)

Source from the content-addressed store, hash-verified

49 }
50
51 function readFile(file){
52 var fileName = file.name;
53 if (fileName.indexOf('.json', fileName.length - 5) === -1) {
54 return alert('Not a JSON file');
55 }
56 var reader = new FileReader();
57 reader.readAsText( file );
58 reader.onload = function (evt){ jsonToScript(evt.target.result); };
59 }
60
61 function loadFile(){
62 var input = elem('input', {'type': 'file', 'accept': 'application/json'});

Callers 1

loadFileFunction · 0.85

Calls 1

jsonToScriptFunction · 0.85

Tested by

no test coverage detected