Stdweb :: File object // get contents

  1. Context: I’m implementing file drag/drop for a Rust/wasm32 webapp.

  2. I’m using stdweb. I am using the DragDropEvent. From this, I get a FileList. From this, I print out the names of the files:

                            let n = file_list.len();
                            let msg = format!("handling dro pevent, num files: {:?}", n);
                            console!(log, msg);
                            for file in file_list.iter() {
                                let msg = format!("name: {:?}",;
                                console!(log, msg);

Now, file is an object of type

  1. here is my problem: I can use to get the name of the file – but how do I extract the data from the File object ?

To read file’s content you need to use FileReader object. stdweb also has FileReader type, but it seems most of its methods are not yet implemented. Maybe you need to read file’s content from JS side and pass it again to Rust?