# fireproof

> Promises for Firebase objects.

Latest version **3.1.0** (published 2015-11-23) · ISC license · 0 weekly downloads

## Install

```sh
npm install fireproof
pnpm add fireproof
yarn add fireproof
bun add fireproof
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 3.1.0 |
| Published | 2015-11-23 |
| First published | 2014-08-21 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 75 |
| Author | Harry Schmidt |
| Maintainers | daguej, goldibex |
| Keywords | firebase, promise, async, await, yield, promisify, es6 |

## Links

- npm: https://www.npmjs.com/package/fireproof
- Repository: https://github.com/casetext/fireproof
- Homepage: https://github.com/casetext/fireproof#readme
- Issues: https://github.com/casetext/fireproof/issues
- npm.io page: https://npm.io/package/fireproof

## Alternatives

- [@commercetools/sync-actions](https://npm.io/package/@commercetools/sync-actions.md) — 25.1K weekly downloads
- [cwait](https://npm.io/package/cwait.md) — 21.4K weekly downloads
- [@ledgerhq/hw-app-cosmos](https://npm.io/package/@ledgerhq/hw-app-cosmos.md) — 4.2K weekly downloads
- [@financial-times/o-loading](https://npm.io/package/@financial-times/o-loading.md) — 2.8K weekly downloads
- [fa](https://npm.io/package/fa.md) — 185 weekly downloads

## Recent versions

- 3.1.0 (latest) — 2015-11-23
- 3.0.4 — 2015-11-20
- 3.0.3 — 2015-08-04
- 3.0.2 — 2015-08-03
- 3.0.1 — 2015-08-03
- 3.0.0 — 2015-07-28
- 2.5.3 — 2015-07-02
- 2.5.2 — 2015-03-05
- 2.5.1 — 2015-03-02
- 2.5.0 — 2015-02-26
- 2.4.3 — 2015-02-05
- 2.4.2 — 2015-01-31
- 2.4.1 — 2015-01-31
- 2.4.0 — 2015-01-30
- 2.3.2 — 2014-12-13
- … 54 more at https://npm.io/package/fireproof/versions

## README

fireproof
=========

Firebase runs hot! Don't burn yourself with callbacks. Use promises instead.
Fireproof wraps Firebase objects with lightweight promise support.

## Installation
```bash
npm install --save fireproof
```

## Usage

See the API documentation [here.](https://github.com/casetext/fireproof/blob/master/api.md)

The bottom line is this: all Firebase methods are reproduced on a Fireproof object.

By default, Fireproof uses the built-in Promise constructor, which is available in Node > 0.12 and many modern web browsers. You can override this behavior by providing a standards-compliant Promise constructor on Fireproof's constructor, like so:

```js
Fireproof.Promise = require('bluebird');
```

You can also choose to "bless" Fireproof with a promise library that follows the deferral model:

```js
Fireproof.bless(require('Q'));
```

If a Promise constructor is not supplied and none exists natively, Fireproof will explode spectacularly.

- If the corresponding Firebase method has no return value but does something asynchronously, Fireproof returns a promise that fulfills if the interaction succeeds and rejects if an error occurs. This is true of, e.g., ```transaction()```, ```auth()```, ```set()```, ```update()```, ```remove()```, and ```once()```.

- For ```on()```, Firebase returns the callback method that you passed in. Fireproof returns your _wrapped_ callback method with an extra method, ```then()```, attached. So the callback is effectively a promise!

- For ```push()```, Firebase returns the reference to the new child. Fireproof does the same, but the reference is also a promise that resolves if the push
succeeds and rejects if the push fails.

- All Fireproof objects are themselves promises. Except for the case of
```push()``` mentioned above, their then() is a shortcut for
```fp.once('value')```. This means you can get the value of any Fireproof object
at any time just by treating it as a promise!

```javascript
var Fireproof = require('fireproof'),
  Firebase = require('firebase');

var firebase = new Firebase('https://test.firebaseio.com/thing'),
  fireproof = new Fireproof(firebase);

fireproof.auth('my_auth_token').then(function() {
  console.log('Successfully authenticated.')
}, function(err) {
  console.error('Error authenticating to Firebase!');
})
```

## Support

IE back to 9.

---
_Source: https://npm.io/package/fireproof · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
