# @mtbjorn/firestorm

> A driver for interacting with Firebase data storage

Latest version **0.0.4** (published 2022-10-16) · ISC license · 0 weekly downloads

## Install

```sh
npm install @mtbjorn/firestorm
pnpm add @mtbjorn/firestorm
yarn add @mtbjorn/firestorm
bun add @mtbjorn/firestorm
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.4 |
| Published | 2022-10-16 |
| First published | 2022-04-04 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 3 |
| Unpacked size | 244.1 KB |
| Known vulnerabilities | 0 (+2 in 2 direct dependencies) |
| Install scripts | no |
| GitHub stars | 0 |
| Author | @CAndRyan |
| Maintainers | mtbjorn |
| Keywords | firebase, utility, utilities |

## Links

- npm: https://www.npmjs.com/package/@mtbjorn/firestorm
- Repository: https://github.com/CAndRyan/MTBjorn.Firestorm
- Issues: https://github.com/CAndRyan/MTBjorn.Firestorm/issues
- npm.io page: https://npm.io/package/@mtbjorn/firestorm

## Dependencies (3)

- [uuid](https://npm.io/package/uuid.md) ^8.3.2
- [firebase](https://npm.io/package/firebase.md) ^9.6.4
- [@babel/runtime](https://npm.io/package/@babel/runtime.md) ^7.16.7

## Alternatives

- [lodash.assign](https://npm.io/package/lodash.assign.md) — 2.3M weekly downloads
- [lodash.chunk](https://npm.io/package/lodash.chunk.md) — 1.8M weekly downloads
- [react-native-ios-utilities](https://npm.io/package/react-native-ios-utilities.md) — 138.5K weekly downloads
- [@technically/lodash](https://npm.io/package/@technically/lodash.md) — 50.9K weekly downloads
- [@fluid-topics/ft-icon](https://npm.io/package/@fluid-topics/ft-icon.md) — 20.6K weekly downloads

## Recent versions

- 0.0.4 (latest) — 2022-10-16
- 0.0.3 — 2022-05-28
- 0.0.2 — 2022-05-18
- 0.0.1 — 2022-04-04

## README

# Firestorm

An interface for interacting with Google Firebase data storage.

## Getting Started

1. Get app config for your Firebase app from the Project Settings page
1. Setup the active Firebase app

    ````javascript
    import { setupActiveFirebaseApp } from '@mtbjorn/firestorm';
    setupActiveFirebaseApp({
		appName: 'appName',
		appConfig: {},
		driverConfig: {}
	});
    ````

    * TODO: support for managing multiple Firebase apps
1. Login to the active Firebase app

    ````javascript
    import { getActiveFirebaseApp } from '@mtbjorn/firestorm';
    const { isUserLoggedIn, login } = getActiveFirebaseApp();
    
    const userIsLoggedIn = await isUserLoggedIn('email');
    if (!userIsLoggedIn) await login('email', 'password');
    ````

1. Logout of the active Firebase app

    ````javascript
    import { getActiveFirebaseApp } from '@mtbjorn/firestorm';
    const { logout } = getActiveFirebaseApp();
    await logout();
    ````

1. Respond to changes in authentication status of active Firebase app

    ````javascript
    import { getActiveFirebaseApp } from '@mtbjorn/firestorm';
    const { addAuthStateListener } = getActiveFirebaseApp();

    const removeAuthStateListener = await addAuthStateListener((auth) => {
        console.log(`Current user: ${auth.email}`)
        removeAuthStateListener();
    });
    ````

1. Upload a file to storage

    ````javascript
    import { uploadFile } from '@mtbjorn/firestorm';
    const url = await uploadFile('fileName', file, 'imagesDirectory');
    ````

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