1 # p-finally [![Build Status](https://travis-ci.org/sindresorhus/p-finally.svg?branch=master)](https://travis-ci.org/sindresorhus/p-finally)
3 > [`Promise#finally()`](https://github.com/tc39/proposal-promise-finally) [ponyfill](https://ponyfill.com) - Invoked when the promise is settled regardless of outcome
11 $ npm install --save p-finally
18 const pFinally = require('p-finally');
20 const dir = createTempDir();
22 pFinally(write(dir), () => cleanup(dir));
28 ### pFinally(promise, [onFinally])
36 Note: Throwing or returning a rejected promise will reject `promise` with the rejection reason.
41 - [p-try](https://github.com/sindresorhus/p-try) - `Promise#try()` ponyfill - Starts a promise chain
42 - [More…](https://github.com/sindresorhus/promise-fun)
47 MIT © [Sindre Sorhus](https://sindresorhus.com)