I have previously been testing a component using the following code
<script>
import x from "/path/to/x.json"
</script>
this, as expected loads the json file to variable x.
What I would like to do, is dynamically load a local json file given an <input> element e.g.
<script>
let files ;
function loadJSONFile(){
doSomething(files[0].name) ;
}
</script>
<input type="file" bind:files on:change={loadJSONFile}>
where doSomething() is doing the equivalent task of import in the first example.
Ideally, I could load the data from any local folder, so bind:files may not be appropriate, as files[0].name seems to yield a relative path, rather than an absolute path.