Replies: 5 comments 9 replies
-
Hello! This is an interesting feature request, and would definitely be useful. This is currently not possible to do directly, since SQLPage currently retrieves each row from the database as a json object, without the ability to efficiently store binary data. |
Beta Was this translation helpful? Give feedback.
-
Another solution is to generate a data url, and then use a simple link to it. select
'button' as component;
select
binary_to_data_url(
my_func(...),
'application/vnd.ms-excel'
) as link,
'Download' as title; With the following small helper function: CREATE OR REPLACE FUNCTION (input_data BYTEA, mime_type TEXT)
RETURNS TEXT AS $$
DECLARE
base64_data TEXT;
BEGIN
-- Convert binary data to base64
base64_data := encode(input_data, 'base64');
-- Construct data URL with provided MIME type
RETURN 'data:' || mime_type || ';base64,' || base64_data;
END;
$$ LANGUAGE plpgsql; |
Beta Was this translation helpful? Give feedback.
-
Thank you @lovasoa |
Beta Was this translation helpful? Give feedback.
-
You might want to consider the Tabulator poc I wrote about here. Tabulator has the download as excel and record paging functionality to the web browser. Depending the amount of records it may work for your usecase. |
Beta Was this translation helpful? Give feedback.
-
Thumbs up for this request. My use case is simpler - just want to serve small static files directly from sqlite. Usually this is faster vs serving from the file system and the added advantage is that all the app data is in a single file (really nice for small apps/prototypes). |
Beta Was this translation helpful? Give feedback.
-
Hello Friends,
I want to download a generated file. I can get the generated file as bytes from a postgresql function. But how can I dump it to the browser as a download.
Something like this would be great:
Beta Was this translation helpful? Give feedback.
All reactions