I'm developing a backend service in NodeJS. It processes images from Google Cloud Storage by requesting a temporary link and sending this link to a third party analysis service. I'd also want the images to be added to a shared Google Drive folder. Is there any possible way to do this easily (e.g. by using the Drive API and posting the link to the file, instead of downloading the file and subsequently uploading it). In other words: does the Drive API accept links to files, instead of uploading them? Or is there any other clever way of sharing Google Cloud to Drive easily (as it's both Google services).
Thanks
Transferring data from Google Drive to Google Cloud Storage We mount Google Drive using the google colab tools which requires authenticating in a separate brower window. Then we authenticate and connect our Google Cloud Storage project, list all buckets, and start copying files from Google Drive to our bucket.
The best way to do this right now would be to use a Google Colab notebook:
# authenticate
from google.colab import auth
auth.authenticate_user()
# set your gcp project
!gcloud config set project my-project
# mount your drive
from google.colab import drive
drive.mount('/content/drive')
gsutil
command to copy your GCP storage data to the mounted drive!gsutil -q -m cp -r gs://my-bucket-name /content/drive/My\ Drive/
I have done some searching but, I don't see a way to add files from Google Cloud Storage to Google Drive other than doing downloading and uploading them. Also AFAIK, gsutil
, which Google Cloud Storage APIs can interact with, also supports downloading and uploading of files when sharing to other storage.
And, as answered in Cloud Storage - Frequently Asked Questions, Google Drive and Google Cloud Storage are two different storage services wherein both allow programmatic access to their functionality, but the goals of the APIs are quite different.
However, you may want to try using Request Endpoints wherein you can access Google Cloud Storage through three request endpoints (URIs). Which one you use depends on the operation you are performing.
IMPORTANT NOTE: The Google Cloud Storage URIs described on this page are subject to change.
You can use the following URLs to access an object:
XML API
storage.googleapis.com/<bucket>/<object>
<bucket>.storage.googleapis.com/<object>
JSON API
www.googleapis.com/download/storage/v1/b/<bucket>/o/<object-encoded-as-URL-path-segment>?alt=media
These URLs support secure sockets layer (SSL) encryption, which means you can use either HTTP or HTTPS. If you authenticate to the Google Cloud Storage API using OAuth 2.0, you should use HTTPS.
You may want to also check Sharing and Collaboration for more information.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With