Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Promise version of finished not calling clean up #486

Closed
rhodgkins opened this issue Sep 7, 2022 · 1 comment
Closed

Promise version of finished not calling clean up #486

rhodgkins opened this issue Sep 7, 2022 · 1 comment

Comments

@rhodgkins
Copy link

rhodgkins commented Sep 7, 2022

function finished(stream, opts) {
return new Promise((resolve, reject) => {
eos(stream, opts, (err) => {
if (err) {
reject(err)
} else {
resolve()
}
})
})
}

Should the promise version of finished call the clean up function returned from the callback version?

So something like:

function finished(stream, opts) {
  return new Promise((resolve, reject) => {
    const cleanup = eos(stream, opts, (err) => {
      cleanup()
      if (err) {
        reject(err)
      } else {
        resolve()
      }
    })
  })
}

Also raised in the main repo nodejs/node#44556

@mcollina
Copy link
Member

mcollina commented Sep 7, 2022

Closed in favor of nodejs/node#44556

@mcollina mcollina closed this as completed Sep 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants