Skip to content

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

Closed
@rhodgkins

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    good first issueIssues that are suitable for first-time contributors.streamIssues and PRs related to the stream subsystem.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions