# cf-upload-file

> A JavaScript function for uploading a local file (using its URI) to Firebase storage.

Latest version **1.0.1** (published 2017-03-05) · MIT license · 0 weekly downloads

## Install

```sh
npm install cf-upload-file
pnpm add cf-upload-file
yarn add cf-upload-file
bun add cf-upload-file
```

## 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 | 1.0.1 |
| Published | 2017-03-05 |
| First published | 2017-03-05 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 7 |
| Author | Rax Canaan Layumas |
| Maintainers | raxkaynan |
| Keywords | cordova, firebase, file, upload, storage |

## Links

- npm: https://www.npmjs.com/package/cf-upload-file
- Repository: https://github.com/raxkaynan/Cordova-Firebase-Upload-File
- Homepage: https://github.com/raxkaynan/Cordova-Firebase-Upload-File#readme
- Issues: https://github.com/raxkaynan/Cordova-Firebase-Upload-File/issues
- npm.io page: https://npm.io/package/cf-upload-file

## Alternatives

- [unionfs](https://npm.io/package/unionfs.md) — 2.2M weekly downloads
- [path-starts-with](https://npm.io/package/path-starts-with.md) — 35.9K weekly downloads
- [redzip](https://npm.io/package/redzip.md) — 1.2K weekly downloads
- [vscode-anymatch](https://npm.io/package/vscode-anymatch.md) — 848 weekly downloads
- [@ledgerhq/coin-filecoin](https://npm.io/package/@ledgerhq/coin-filecoin.md) — 793 weekly downloads

## Recent versions

- 1.0.1 (latest) — 2017-03-05
- 1.0.0 — 2017-03-05

## README

# Cordova Firebase Upload File

A JavaScript function for uploading a local file (using its URI) to Firebase storage.


The function requires [jQuery](https://github.com/jquery/jquery).

## Installing

`npm install cf-upload-file`

or

`bower install cf-upload-file`

## Example Usage

The example usage is taking a picture and uploading it to Firebase

	// Do not forget to include the file (<script src='path/to/cf-upload-file.js'></script>)

	var storageRef = "path/to/firebase/storage";
	var options = { 
		sourceType: Camera.PictureSourceType.CAMERA,
		destinationType: Camera.DestinationType.FILE_URI
	};
	navigator.camera.getPicture(function(imageURI) {
		cfUploadFile(storageRef, imageURI, "image/jpeg")
			.then(function(snapshot) {
				// upload success, handle returned snapshot (firebase.storage.UploadTaskSnapshot)
			}).catch(function(err) {
				// handle error
			});
	}, function(err) {
		// cordova error
	}, options);

The function `cfUploadFile` takes 3 parameters (all string types). The first parameter will be your **Firebase storage path**, which is the location in which you would want to store the file. The second parameter will be the **file URI**. And lastly, the third parameter will be the **file type**.

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