This package has been deprecated

Author message:

Deprecated

p-finally

3.0.0 • Public • Published

p-finally

Promise#finally() ponyfill - Invoked when the promise is settled regardless of outcome

Useful for cleanup.

Install

$ npm install p-finally

Usage

import pFinally from 'p-finally';

const directory = createTempDirectory();

await pFinally(write(directory), () => {
	cleanup(directory);
});

API

pFinally(promise, onFinally?)

Returns a Promise.

onFinally

Type: Function

Note: Throwing or returning a rejected promise will reject promise with the rejection reason.

Related

  • p-try - Promise.try() ponyfill - Starts a promise chain
  • More…

Get professional support for this package with a Tidelift subscription
Tidelift helps make open source sustainable for maintainers while giving companies
assurances about security, maintenance, and licensing for their dependencies.

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Published

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 2.0.1
    2,473,632
  • 2.0.0
    30
  • 1.0.0
    16,219,133

Package Sidebar

Install

npm i p-finally

Weekly Downloads

18,693,225

Version

3.0.0

License

MIT

Unpacked Size

3.32 kB

Total Files

4

Last publish

Collaborators

  • sindresorhus