> gdrive.files.list({
auth: client,
userId: accountId,
pageToken: nextPageToken,
pageSize: 200, // tried 1000 as well as the documentation says pageSize can be within range of [1,1000]
// orderBy: 'modifiedTime', // tried this option as well to see if it helped... it didnt
}, function (err, result) {
console.log(result.files.length)
})
100
my account has thousands of files, i actually had this function in a recursive function where if there was a nextPageToken i would call gdrive.files.list again. every time it would only return between [0, 100].
here is a reference to the gdrive v3 api https://developers.google.com/drive/v3/reference/files/list
pageSize integer The maximum number of files to return per page. Acceptable values are 1 to 1000, inclusive. (Default: 100)
is there some hidden condition to be able to get more than 100 files in a single api call?
Thanks!
I tried this using the API explorer on the side of the page you linked, and I couldn't reproduce the error. (Does that also have the same problem for you?)
Also, is it possible that there are only 100 files that match your query? (It looks like team drive items are not included by default.)
i definitely have more than 1000 files in my account. I did try the api explorer and it is indeed returning pageSize number of files. (the last screenshot shows me calling the api multiple times using the returned pageToken from the previous api call)



seems like a bug in the library.
Another question - what happens when you set pageSize to 50?
(If you get 50 results, then it's likely the library's fault. If you still get 100, I'd have to take a closer look at your code.)
@ace-n thanks for responding.
i get 50 at a time when I specify 50.


Apparently this only happens if files(permissions) is added to the field string.
This seems to be a bug with the google drive API and not with the nodejs client, since it happens on the API explorer as well.
If this is present in the API, there's not a lot we can do here :( Closing this out for now.
I had the same problem and solved it by adding
maxResults:1000
so in the end i had
pageSize:1000,
maxResults:1000
Most helpful comment
Apparently this only happens if
files(permissions)is added to the field string.