title: Google Cloud Storage sort objects by their last modified date
body: <p>How do I sort the files by their last modified date? The code below just sorts them out by their extension (json or jpg)</p>
  
  <pre><code>function ambilData(req, res) {
    let hasil;
  
    ember
    .getFiles(options)
    .then(results =&gt; {
      const files = results[0];
      const tempArr = [];
      let jsonArr = [],
          jpgArr = [];
  
      files.forEach(file =&gt; {
        let nama = file.name,
            mapped = nama.slice(9, nama.length);
  
        tempArr.push(mapped)
      });
  
      tempArr.shift();
      tempArr.forEach(file =&gt; {
        if (file.split('.')[1] == 'json') {
          jsonArr.push(file)
        } else {
          jpgArr.push(file)
        }
      })
  
      res.send(listToMatrix(jsonArr, jpgArr))
    })
    .catch(err =&gt; {
      console.error('ERROR:', err);
    });
  }
  </code></pre>
  
  <p>I am using Node.JS, and are going to use express to write the code above into a REST API. </p>