Using bucket.getFiles()
it is possible to get all the files in a bucket.
My bucket has thousands of files and I really only want to get metadata on the
There is an ability to specify a prefix of the required path in options, e.g.
async function readFiles () {
const [files] = await bucket.getFiles({ prefix: 'users/user42'});
console.log('Files:');
files.forEach(file => {
console.log(file.name);
});
};
This example is the last here: https://cloud.google.com/nodejs/docs/reference/storage/2.3.x/Bucket#getFiles
It's sad that there is so little information about possible options for methods. Hope documenting team will change it soon.