How to use the @firebase/app.firebase.storage function in @firebase/app

To help you get started, we’ve selected a few @firebase/app examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github hand-dot / taskontable / src / utils / util.js View on Github external
const browserName = parser.getBrowser().name;
const osName = parser.getOS().name;
const deviceType = parser.getDevice().type;

let database;
let auth;
let messaging;
let storage;
if (process.env.NODE_ENV !== 'test') {
  firebase.initializeApp(firebaseConf);
  database = firebase.database();
  auth = firebase.auth();
  if (constants.SUPPORTEDBROWSERS.indexOf(browserName) >= 0 && osName !== 'iOS') { // safari,iosではエラーになるため
    messaging = firebase.messaging();
  }
  storage = firebase.storage();
}

export default {
  /**
   * firebaseのdatabaseを返します。
   */
  getDatabase() {
    return database;
  },
  /**
   * firebaseのauthを返します。
   */
  getAuth() {
    return auth;
  },
  /**
github deckgo / deckdeckgo / studio / src / app / services / storage / storage.service.tsx View on Github external
return;
                    }

                    if (!data || !data.name) {
                        this.errorService.error('Image not valid.');
                        resolve();
                        return;
                    }

                    if (data.size > 10485760) {
                        this.errorService.error(`Image is too big (max. ${maxSize / 1048576} Mb)`);
                        resolve();
                        return;
                    }

                    const ref: Reference = firebase.storage().ref(`${authUser.uid}/assets/${folder}/${data.name}`);

                    await ref.put(data);

                    resolve({
                        downloadUrl: await ref.getDownloadURL(),
                        fullPath: ref.fullPath,
                        name: ref.name
                    });
                });
            } catch (err) {