I have two functions: one that turn files into dataUrl and another that returns a promise with the result:
fileToDataURL(file) {
var reader = new FileReader()
return new Promise(function (resolve, reject) {
reader.onload = function (event) {
resolve(event.target.result)
}
reader.readAsDataURL(file)
})
}
getDataURLs (target) {
// target => <input type="file" id="file">
return Promise.all(target.files.map(fileToDataURL))
}
target.files.map returns: TypeError: target.files.map is not a function
. H
How to modify getDataUrls
so it returns an array with the dataUrls?