Skip to content

taishikato/firebase-storage-uploader

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

@taishikato/firebase-storage-uploader

A library to upload a image on Firebase Storage📸

npm (scoped) npm bundle size (scoped)

Install

With npm

$ npm i @taishikato/firebase-storage-uploader

With yarn

$ yarn add @taishikato/firebase-storage-uploader

Usage

// CommonJS
const uploadImage = require('@taishikato/firebase-storage-uploader').default;
// ES6
import uploadImage from '@taishikato/firebase-storage-uploader';

import firebase from 'firebase/app'
import 'firebase/storage'
if (!firebase.apps.length) {
  firebase.initializeApp({
    apiKey: <apiKey>,
    authDomain: <authDomain>,
    databaseURL: <databaseURL>,
    projectId: <projectId>,
    storageBucket: <storageBucket>,
    messagingSenderId: <messagingSenderId>,
    appId: <appId>,
    measurementId: <measurementId>
  })
}

const imageUrl = 'data:image/jpeg;base64,/9j/4gIcSUNDX1BST0ZJTEUA…'

uploadImage('users/John.png', imageUrl, firebase).then(result => {
  console.log(result) // You can access to your image file via this URL of firebase storage
})

About

A library to upload a image on Firebase Storage📸

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published