Skip to content

Instantly share code, notes, and snippets.

View EricSeastrand's full-sized avatar

Eric Seastrand EricSeastrand

View GitHub Profile
@EricSeastrand
EricSeastrand / pushFileToStorage.ts
Last active January 2, 2023 18:52 — forked from mrgarymartin/pushFileToStorage.ts
Angular Fire Upload tasks
pushFileToStorage(fileUpload: FileUpload) { // Pass in a callback as argument
const filePath = `${this.basePath}/${fileUpload.file.name}`;
const storageRef = ref(this.storage, filePath);
const uploadTask = uploadBytesResumable(storageRef, fileUpload.file);
uploadTask.on('state_changed',
(snapshot) => {
// Observe state change events such as progress, pause, and resume
// Get task progress, including the number of bytes uploaded and the total number of bytes to be uploaded