My program:
but when I access the Google Cloud bucket, all files are stored in the root folder of the bucket
I would expect that it stores the file into the folder "Users/myname/folder/"
Solved by specifying the destination option
return storage
.bucket(bucketName)
.upload(filename, {
destination: 'folder/'+filename,
})
.then(() => {
console.log(`${filename} uploaded to ${bucketName}.`);
})
.catch((err) => {
console.error('ERROR:', err);
});
Most helpful comment
Solved by specifying the destination option