0

I am trying to use the GCP client api to get list of folders inside a bucket.

I have a function such as below:

export async function getTritonModels(bucketName, path) {
  try {
    let models = null;
    const bucket = storage.bucket(bucketName);
    models = await bucket.getFiles(query, (err, files, nextQuery, apiResponse) => {
      return [...apiResponse?.prefixes]
    });

    console.log("models:", models)

  } catch (err) {
    return []
  }
}

This is still returning null for models - how can I set the models value inside the callback function?

ashes999
  • 1,234
  • 1
  • 12
  • 36

0 Answers0