SQLpage icon indicating copy to clipboard operation
SQLpage copied to clipboard

Support for inserting uploaded file content in db as bytes for streaming upload/download

Open djyotta opened this issue 8 months ago • 2 comments

What are you building with SQLPage ?

A tool to share files.

What is your problem ? A description of the problem, not the solution you are proposing.

Upload: I can't do streaming upload into the db because the data_uri is manifested as a string in memory first.

Download: I use an external service to provide a streaming download of the data. But this is not as ideal as it could be because I have to decode the data_uri from the db first (buffer in memory before download starts). Theoretically, one could decode a data_uri as a stream, but ideally I could just stream the bytes of the blob as is.

What are you currently doing ? Since your solution is not implemented in SQLPage currently, what are you doing instead ?

I'm storing uploaded files as data uri in db and using an external service to provide the download.

Describe the solution you'd like

I'd like to store the bytes alone as blob in db. Ideally this could be inserted into db as a streaming upload to avoid buffering entire file in memory.

~~SQLite buffers blobs in memory anyway, but other dbs may not.~~ Even sqlite supports streaming blobs https://www.sqlite.org/c3ref/blob_open.html

Actually, streaming download could be a great featur for SQLPage (a new component maybe like the JSON component...?).

djyotta avatar Jun 09 '24 11:06 djyotta