user16604664
user16604664

Reputation:

How to upload several images to Google Cloud Storage using Node.js

Looking for help to achieve the following points in GCS.

  1. I want to be able to upload one object that is composed of two or more images to GCS.
  2. All images, grouped in one object are uploaded at the same time. In other words as a bulk.
  3. The object, composed of several files/images, has its own Id or a property that can be used to query the object. Reading the GCS API docs, I found the method to upload one single image at a time. Also, reading similar questions in Stack Overflow, I have found how to upload several images at the same time but individually no as a bulk. However, I can not find a method provided by the API to group several images into an object and upload the object to GCS.

Upvotes: 0

Views: 622

Answers (1)

Sandeep Vokkareni
Sandeep Vokkareni

Reputation: 1675

You can create a composite object in order to merge multiple images together in a single object - here is the documentation for this in Node.js

Nonetheless, composing objects requires that the source files are already stored in the same storage bucket and must have the same storage class;see document for More details.

Because of this, the composite object can only be created once all the files that you are willing for it to be composed of are stored in the same bucket.

For this reason, in case you would like to have this done prior to uploading to GCS, you should implement logic on node.js side like merging objects before uploading to gcs.

You can have a look at this document Node.js — How to Merge Objects.

Upvotes: 0

Related Questions