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 files in a particular folder.
The documentation is not clear on how to just get the files from a folder. Apparently it is possible to limit the results with a GetFilesRequest
but none of the options include a path or a folder, at least not explicitly.
Google Cloud lets you choose the best environment to run your Node. js applications, with options for serverless, Kubernetes, VMs, or custom hardware.
Google Cloud Filestore, recently launched into Beta, is a managed file service for your apps. This session provides a product overview, features, pricing, and common use cases. We culminate with a demo integration with other GCP services showing an.
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);
});
};
Now it's finally available on documentation (thanks @Wajahath for the update): https://googleapis.dev/nodejs/storage/latest/Bucket.html#getFiles
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With