How to use the storage function from firebase-admin

Find comprehensive JavaScript firebase-admin.storage code examples handpicked from public code repositorys.

81
82
83
84
85
86
87
88
89
90
91
92
	credential: admin.credential.cert(serviceAccount),
	storageBucket: 'csi-innovations.appspot.com'
});


//firebase bucket
var bucket = admin.storage().bucket();


//function to upload file
async function uploadFile(filepath, filename) {
	await bucket.upload(filepath, {
fork icon0
star icon4
watch icon2

+ 8 other calls in file

31
32
33
34
35
36
37
38
39
40
  console.log(`File ${filePath} is not in CSV format, skipping...`);
  return false;
}

// create a reference to the Cloud Storage file and set up a CSV parser
const bucket = admin.storage().bucket(fileBucket);
const file = bucket.file(filePath);
const csvStream = file.createReadStream().pipe(
  parse({
    delimiter: [";", ",", "\t", "|"],
fork icon0
star icon3
watch icon0

+ 4 other calls in file

420
421
422
423
424
425
426
427
428
429
    },
    contentType: pdfDoc.mimetype,
    cacheControl: 'public, max-age=31536000'
};

const bucket = firebase.storage().bucket();
const filePath = `doc-file/${uuid() + '--' + pdfDoc.originalname}`;
const blob = bucket.file(filePath);
const blobStream = blob.createWriteStream({
    gzip: true,
fork icon0
star icon0
watch icon1

+ 34 other calls in file

176
177
178
179
180
181
182
183
184
185
    });
  } else {
    res.status(300).send({ msg: "SmeIPO Not Found" });
  }
}
webApp.locals.bucket = admin.storage().bucket();

// const uploadImage = async (req, res) => {

//   const GeneralIPO = {
fork icon0
star icon0
watch icon1

+ 15 other calls in file