Start a new topic

Upload image to GCS from nodejs server

Hello support team,

I'm developing small nodejs server which import social network's posts to Kinvey storage. My problem is the next:
I have an image URL(for example and I need to upload it on GCS. I'm using kinvey nodejs module and upload method from documentation
As I know I need to pass image in blob format for correct upload, but the problem is that nodejs server isn't running in browser and I can't use Blob object. I tried ArrayBuffer, but it's uploaded incorrectly.
Which data format can I use in my case? Is it possible at all to upload image from nodejs server without browser support?


1 Comment

Hi Yegor,

I just tested the sample code in the tutorial with latest Kinvey SDK for Node.js (1.5.1). When I gave 'utf8' encoding in fs.readFile for setting fileContent variable, the file was uploaded in a broken format. But, when I removed encoding, I didn't run into any issues.

Could you answer a couple of questions:

  1. Are you downloading the file to disk before attempting to upload it to Kinvey GCS?
  2. Are you specifying encoding parameter while trying to load the file in a buffer?

Also, please share relevant code snippet for setting fileContent variable. I will take a look at it as well.



Login or Signup to post a comment