🚀 Big News:Socket Has Acquired Secure Annex.Learn More →
Socket
Book a DemoSign in
Socket

p-finally

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

p-finally

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

latest
Source
npmnpm
Version
3.0.0
Version published
Weekly downloads
30M
2.94%
Maintainers
1
Weekly downloads
 
Created
Source

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.

  • 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.

Keywords

promise

FAQs

Package last updated on 09 Apr 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts