Storage - download files in 1 request

I have a select request which gets information from a table. Among these information, I get the bucket_id and path of some files stored in the S3 storage. Is there a way to get the raw string file from within the select request or it's mandatory to perform a second request with the download() method of the storage object like so:
supabase
  .storage
  .from(bucket_id)
  .download(path)

Doing this in just 1 request would simplify the client side code and make the content appears all at once instead of having the text to appears and later on the images.

According to this: https://supabase.com/docs/guides/database/extensions/plv8#create-plv8-functions
I can use the JS extension and that will give me access to the supabase object inside database functions? I assume that by looking at the JavaScript example under the sentence: You can call plv8 functions like any other Postgres function:. Is that true? If yes, I will be able to build a database function to select the info from the database & get the raw string from the S3 storage so that would be everything I need.

Otherwise, I suppose that I can do a normal postgresql database function to perform the select and use the HTTP extension to get the raw string from the S3 storage, I just have to grab the get url from the download method (I found it in the node_modules), right?
JavaScript language for PostgreSQL.
Was this page helpful?