firebase getdownloadurl code example
Example 1: getDownload url in firebase
const storage = firebase.storage();
storage.ref('image.jpg').getDownloadURL()
.then((url) => {
// Do something with the URL ...
})
Example 2: getDownload url in firebase
match /path/to/{file} {
// Deny reads
allow read: if false;
// Or, allow reads by authenticated users
allow read: if request.auth != null;
}
Example 3: get download url firebase functions
const createPersistentDownloadUrl = (bucket, pathToFile, downloadToken) => {
return `https://firebasestorage.googleapis.com/v0/b/${bucket}/o/${encodeURIComponent(
pathToFile
)}?alt=media&token=${downloadToken}`;
};