Leslie Alldridge
Leslie Alldridge

Reputation: 1583

Jimp write image to Google cloud storage node js

I'm currently writing images to my filesystem using jimp.

For example: image.write('path')

This cannot be used on Google App Engine because its read only filesystem.

How can I write this to a Google storage bucket? I've tried writestreams but keep getting read only errors so I feel like jimp is still writing to the drive.

Thanks heaps

Upvotes: 2

Views: 510

Answers (1)

Chris32
Chris32

Reputation: 4961

As I can understand you are modifying some images on your App Engine and you want to upload them to a bucket but you didn't mention if you are using standard or flex environment. In order to do this you want to make your publicly readable so it can serve files.

Following this Google Cloud Platform Node.js documentation you can see that to upload a file to a bucket you need to create object first using:

const blob = bucket.file(yourFileName);

Then using createWriteStream you can upload the file

Upvotes: 1

Related Questions