Blob Storage
Freestyle doesn’t provide a new blob storage API, it simply allows you to store the builtin JavaScript Blob class in your data. Behind the scenes freestyle is extracting the blobs from your data and storing them separately from the rest of your data.
Let’s build an example. Let’s say you want to allow users to upload images to your site.
To expose images to the frontend, we’ll need to implement a special method called fetch. Fetch allows you to define how a class should behave to a rest API. In this case, we’ll use it to allow the browser to download the image.
We’ll also implement a method for our convenience that returns the url to this class instance. Note that this URL is not user configurable, this is the URL that cloudstate instances will be served from.
Let’s also add a method to our App class that returns the url and name of all the images.
And then finally, we can display the images in our frontend.