Closed EvilJordan closed 3 years ago
I got help and got it working. Promises are so confusing.
await new Promise((resolve, reject) => {
tinify.fromBuffer(BUFFER).toBuffer(async function(err, resultData) {
await s3Manager.putObject(BUCKET, FILENAME, resultData);
resolve();
});
});
Given this simple function, how do I make tinify do its thing before "Complete!" is returned?
I've tried a multitude of different promise-wrapping methods, so I must be doing something simple incorrectly. I can't seem to get the return value of
myFunction
to happen only after tinify has finished its job.