Skip to content
This repository was archived by the owner on Feb 12, 2024. It is now read-only.
This repository was archived by the owner on Feb 12, 2024. It is now read-only.

Promisify stop()? #1076

Closed
Closed
@haadcode

Description

@haadcode

We currently return from stop() with a callback.

In order to stop IPFS properly, we write:

ipfs.stop(() => {
// do other shutdown things
})

I find myself often preferring to use Promises and more recently await. As per IPFS api functions, we return a Promise (or callback) and I find it confusing that stop() is only callback.

If we returned a Promise, we would write:

ipfs.stop().then(() => {
// do other shutdown things
})

// Or:
await ipfs.stop()
// do other shutdown things

I'd like to propose we promisify the stop function.

We would keep the original callback in addition to returning a Promise, same as we do for API functions and the start() function.

How does everyone feel about this?

I'd be happy to PR this, but this would be a great task for first contributors if someone wants to work on it!

Metadata

Metadata

Assignees

No one assigned

    Labels

    exp/noviceSomeone with a little familiarity can pick uphelp wantedSeeking public contribution on this issue

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions