I would like to display all the folders from my Google Cloud Storage bucket on my Node.js app but there is only getFiles() function.
For example a folder named /abc, with 2 files in it /a & /b. I would like to only get /abc/ and no /abc/a & /abc/b.
app.js
router.get('/', async(req, res) => {
let bucketName = 'my-bucket'
const storage = Storage();
const [files] = await storage.bucket(bucketName).getFiles();
let app = [];
for (const file of files) {
const [metadata] = await file.getMetadata();
app.push(metadata);
};
res.render('views/list.ejs', {
apps : app,
});
});