title: Await a nested function wrapped by a sync func Javascript
body: <p>The prompt is quite simple but I was not able to figure out a solution, unfortunately.</p>
  <p>I have to file a create API then update API. Normally, I can do promise, async/await, or even callback. However, the createAPI is wrapped by a formData function(getLength) since it needs to attach a file. Because of that, I'm not able to await the inner API before firing off an update.</p>
  <p>Since getLength does not return anything and it's not a promise, I'm not sure how I may be able to work around this? Thank you!</p>
  <pre><code>const createFunc = async () =&gt; {
      formData.getLength(async (err, length) =&gt; {
          await platformAPI
              .createAPI(formData, length)
              .then((res) =&gt; {
                  if (res !== 201) {
                      console.log(&quot;something went wrong&quot;)
                  }
                  console.log(&quot;it works&quot;) 
              });
      });
  }
  
  
  const apiFunc = () =&gt; {
      createFunc().then(() =&gt; updateApi())
  }
  </code></pre>