Skip to content

Promisify encodeWav.js ? #12

Description

@jmarcosfer

Currently encodeWav expects a callback that will be passed the blob after a 30ms timeout.

Why is the timeout necessary in a function that appears to be otherwise fully synchronous? I tried swapping the setTimeout for a simple return blob; and it works fine.

Assuming there's some asynchronicity that has to be waited for, why not return a promise that resolves with the blob?

In my use case, I'm encoding many different chunks of audio and then putting the blobs into a zip file for download, so I have to wait for all blobs to be returned. The callback was not a practical solution for me, but maybe other people using this library typically don't have this problem and are okay with the callback solution.

I could submit a PR with a very simple change to promisify encodeWav, but I wanted to understand the library's rationale first.

Thanks!

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions