Quantcast
Channel: Active questions tagged rest - Stack Overflow
Viewing all articles
Browse latest Browse all 3630

Is there a way to do file analysis prior to uploading large files to Google Cloud Storage?

$
0
0

We have a python fastapi RESTAPI backing a frontend and want to allow users to upload files to our gcp instance (esp via a frontend drag and drop but also via an API call). I want to use the GCP URL based file upload to a Google Cloud Storage bucket but I want to do file validation on these csv files first (some simple file checking like csv headers are what we expect etc, file type is csv etc.). These files will likely be around 1 GB or more and if possible, I don't want to load the whole file into memory. I couldn't find a way to insert a kind of validation function into the GCS upload. In which case is the way to go just:

  1. allow users to upload to the GCS generated URL
  2. Then programmatically read the newly uploaded file from the GCS bucket and do file validation on the csv header in memory.
  3. Delete the file from the GCS bucket if the file is not valid

Is there a way to do this that avoids the upload entirely in the case of invalid files?


Viewing all articles
Browse latest Browse all 3630

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>