0

I currently have a website and uploading files is a major component. Recently some larger files have come in the website was unable to upload them. I believe I am using a first gen gcp and it is limiting my upload size to 10MB. So I started zipping my files before uploading them with jsZip which was too slow, so I switched over to fflate which significantly improved performance. However, I noticed that my files are making it to the backend and my response is status 200 but the files fail to appear in my google cloud bucket. My log isn't showing any issues so I'm a bit confused about what could be causing the issue. Is there some difference when uploading zip vs txt files?

I am receiving a formData object that is stored as {fileName,zipped file}. When logging my req.body I get <Buffer 123...>

Code

app.post('/uploadNewFiles',async(req,res)=>{

console.log(req.body)

try{
    
    const file = bucket.file(req.body)

    await file.save(req.body,(error)=>{
        if(!error){
            console.log('file issue')
        }else{
            console.log('no issue')
        }
    })

    console.log('end of upload function')

    res.json('no error')
    
}catch(error){
    console.log(error)
    res.json(false)
}

})

  • 1
    can you have a look at this stackoverflow [link](https://stackoverflow.com/questions/71371708/how-to-create-text-file-in-google-cloud-storage-without-saving-it-locally) – Sathi Aiswarya Mar 19 '23 at 15:10

0 Answers0