I am trying to call two function from another function so How I can I get returns back properly
// s3 manage file
const imageCopyAndDelete = async (oldName, newName, area) => {
await s3.copyObject(copyparams).promise();
await s3.deleteObject(paramsDelete).promise();
}
//api file
exports.BSComponentUpdadeCompoName = async (req, res, next) => {
let response = await imageCopyAndDelete(oldName, newName, 'folder');
// further steps
});
Trying with promise but I dont understand how to call multiple function
// return new Promise(resolve => {
// s3.copyObject(copyparams, (err, data) => {
// if (err) {
// resolve(err);
// }
// resolve(data);
// });
// });
Via Active questions tagged javascript - Stack Overflow https://ift.tt/s9FjxnQ
Comments
Post a Comment