I am running following code in Node.js app:
var GoogleCloudStorage = require('@google-cloud/storage');
var storage = GoogleCloudStorage({
projectId: 'PROJECT_ID',
keyFilename: 'keyfile.json'
});
It is showing this error
GoogleCloudStorage is not a function
What is the mistake?
Change your code to:
const {Storage} = require('@google-cloud/storage');
const storage = new Storage({
projectId: 'PROJECT_ID',
keyFilename: 'keyfile.json'
});
I could not get the nodejs compiler to accept GoogleCloudStorage
.