I've a image stream that result from sharp, after resizing the image I wanna upload it to google storage. Here is my code:
const remoteWriteStream = storage
.bucket(storageBucket)
.file('products/'+mediumName)
.createWriteStream({
metadata: {
contentType: 'image/jpeg'
}
});
sharp(result)
.resize({width: 1440})
.pipe(remoteWriteStream)
.on('finish', () => {
resolve(mediumCloud);
console.log("IMAGE PATH: ", url)
});
it successfully create file in cloud storage, with datatype 'image/jpeg'. But it can't view, when I tried to open the file, the preview on right side only show loading. I thought it was caused the access token is not defined. Howw do I can set the access token for each upload?