i store my image on firebase storage now i wanted to display it on my page
const firebase = require('./../config/firebase');
const gcloud = require('google-cloud');
const fs = require('fs');
var storage = gcloud.storage({
projectId: 'test-a1e76',
keyFilename: 'test-a1e76-firebase-adminsdk-7111d-124guy123eac.json',
});
var bucket = storage.bucket('test-a1e76.appspot.com');
this is how my set up looks like.
and this is my get method.
router.get('/image', function (req,res) {
var remoteReadStream = bucket.file('download.png').createReadStream();
var localWriteStream = fs.createWriteStream('/images/watchers/2jIompF9FUZ6A4LnpBcbpHWw8dx2/download.png');
var ss = remoteReadStream.pipe(localWriteStream);
res.send(ss);
})
i only tried this since it was written on the npm docs.of google-cloud works. i tried putting it inside get method to see how it works.
and after that i got this error..
Error: ENOENT: no such file or directory, open 'C:\images\test\2jIoasd24zd13ase121s2Ww8dx2\download.png'
this is my ajax get method
$.ajax({
url:'/user/image',
type:'GET',
success:function(data){
console.log(data.path);
}
});
can anyone here guide my on how can i retrieve the images from firebase storage and display it on my webpage?. using this google-cloud npm? cause i read some thread that node js doesn't support firebase-storage so they use google-cloud instead.