I have an array with file names as array objects. I wanted to sort this array based on file size.
For example,
var arr=['index.html','README.md','index.html'];
So what I currently have is that I am creating an object with the name of the files as the key and the file size as the value.
Now I am extracting these files from a remote location, so I can get the file size from the header content-length.
Is there a better way to do this? Will it be possible to do this locally, with which I mean the file size to read and create an object based on this?
source
share