jakiestfu / stability-ts

DreamStudio Client written in TypeScript
156 stars 33 forks source link

Get back the original image blob received from the Stability AI API instead of using an output path? #19

Open roschler opened 11 months ago

roschler commented 11 months ago

Hello. Thank you for creating this easy to use client package to the Stability AI API.

I am using the code below to generate images. It works great. However, I would like to get the image blob returned from the Stability AI API instead of the current case where your package writes it to the specified output path on my behalf. This would be very helpful for two important reasons:

1) I store the generated image files in an AWS S3 bucket. If I could get the original image blob and put it directly to S3, it would save the unnecessary intermediary step of the image blob being written to the server's local storage.

2) By eliminating the need for local storage, the Node.js code I have would be more amenable to execution contexts like AWS Lambda functions or other alternate contexts.

Is there a way to use the library this way? I looked at the minified code for generateAsync() and I sawa ternary statement that defaults to the console out if the output path specified in the call is empty. That isn't helpful in my use case. If not, it would be great to have this feature added to the library (direct return of the received image blog for the generated image).