No estoy seguro de cómo extraer los datos de esta función a continuación. Es una función de aws-sdk. Puedo ver el registro de la consola, pero no puedo guardarlo en una variable... incluso si es una variable global.
Siempre he tenido problemas con este concepto... y si alguien pudiera ayudarme a darle más sentido, sería genial.
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 no está definido. :/