const {Storage} = require('@google-cloud/storage');
const fs = require('fs');
const { createReadStream } = require('original-fs');
const util = require("util");
const Multer = require("multer");
const maxSize = 2 * 1024 * 1024;
//const bucketName = 'trialE.json';
const bucketName = 'gcloudconnection.json'
const GOOGLE_CLOUD_PROJECT_ID = 'xxxxx';
var element = document.getElementById("log-in")
element.onclick = async function onclick(){
const gc =new Storage({
projectId : GOOGLE_CLOUD_PROJECT_ID,
keyFilename : bucketName
})
const Bucket= gc.bucket('lawflow');
const file = Bucket.file('testtrial');
//-
fs.createReadStream('/path/to/file')
.pipe(file.createWriteStream())
.on('error', function(err) {
console.log(err)
})
.on('finish', function() {
console.log("DONE");
});
}
Above is the code from the official google docs, however, when I try running this it throws me an error saying: enter image description here
TypeError: Failed to execute 'fetch' on 'Window': Failed to read the 'signal' property from 'RequestInit': Failed to convert value to 'AbortSignal'.