I’m busy trying to build my markdown previewer but i’m finding it difficult to read a .txt file from dropbox into a text area. I started with the following code:
var reader = new FileReader();
var file= “https://www.dropbox.com/l/scl/AAChYBKjjs4ecYB73_ajfySqhgH7uOrfIeA”;
var text = reader.readAsText(file);
document.getElementById(‘displayArea’).innerHTML = text;
but i’m getting the following error:
Uncaught TypeError: Failed to execute ‘readAsText’ on ‘FileReader’: parameter 1 is not of type ‘Blob’.
I’ve been reading the documentation but i’m not getting any wiser.
Could someone tell me what i have to do with the url/file to make it a blob type or maybe point me to another source where i can learn more about using the FileReader API.