Skip to content
Advertisement

editly – Where can I get the return value after a video is created?

Quick question…

Following along the README of editly, I managed to create videos after calling editly like this:

    // create video
    editly(editSpec)
        .catch(console.error);

Unfortunately, I am using ExpressJS to do this and I need to send back a response when video creation completes.

However, when I tried to extract any value using .then, it returns undefined:

    // create video
    editly(editSpec)
    .then(r => {
        console.log(`Is this undefined? Probably yes! r: `, r)
        res.json(r)
    })
        .catch(console.error);

How can I accomplish this?

Advertisement

Answer

For anyone who got stuck on trying to wait for the return value of editly within the context of ExpressJS, here is how I was able to solve this:

        // create video via Promise.all
        Promise.all([
            editly(editSpec).catch(e => { return e } )
        ])
        .then(r => {
            console.log(`r: `, r) // still returns undefined but its ok now!  [ undefined ]
            res.json({message: "complete"})
        })
User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement