I recently started to study the Google Drive API. I'm able to list all Drive files and have access to all of their attributes. However, I was asked to search only for image files.
What did I do? I played the search code inside a JavaScript:
if(file.extension === 'jpg' || file.extension === 'png')
But there you go. My search is parsing all the drive files and listing only the .jpg and .png files, making my search very poorly optimized. I wonder if anyone could help me. I want my search to scour the Drive and return only the img extension files. Here is the code that searches the files stored in Drive.
function listFiles() {
gapi.client.drive.files.list({
'maxResults': 1000
}).then(function(response) {
appendPre('Arquivos:\n');
var files = response.result.items;
if (files && files.length > 0) {
for (var i = 0; i < files.length; i++) {
var file = files[i];
appendPre(file.title +' - '+ file.embedLink);
Follow the API link link . Thanks in advance.