Skip to content

Promise version of streams.finished not calling clean up #44556

Description

@rhodgkins

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();
      }
    });
  });
}

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

    good first issueIssues that are suitable for first-time contributors.streamIssues and PRs related to Node.js streams.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions