Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

126
Views
Can you help me in extracting data from a listObjectsInBucket function from aws-sdk using nodejs?

I am not sure how to extract the data out of this function below. It is a function from aws-sdk I can see the console log, but I am not able to save it in a variable.. even if its a global variable.

I have always had trouble with this concept.. and if anyone could help me make more sense of it, that would be really great.

   const listObjectsInBucket =  (bucketName) => {

  // Create the parameters for calling listObjects
  let pdfList = ''

  const bucketParams = {
    Bucket: bucketName,
  };

  // Call S3 to obtain a list of the objects in the bucket
   s3.listObjects(bucketParams, function (err, data) {
    if (err) {
      console.log("Error", err);
    } else {
      pdfList = data
      // console.log("Success", data);
    }
  });
}

pdfList is undefined. :/

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!