Convert FileList into Array
Posted on October 24, 2019
From this source today I've learned this trick to convert a FileList object to Array, this way I can use some useful methods such as
FileList is the object you get when using
readAsDataURL to read the source base64 of an image.
If you are trying to load multiple images, the FileList object is a kind of Array but under the hood is an object, thus you cannot use some specific Array' methods.
Here the one-line convertion with ES6:
const files = [...myFileList]