On 20.09.2023 at 11:10, NGC 147 wrote:
> If I didn't have mistakes, I wouldn't write here. But I did everything
> according to the documentation and it didn’t work.
Just a suggestion: solve two sub-problems independently. First, in your
express app, read an image (always the same image) from a local file and
send it back to the browser. Make it work so that you can actually see
the image in the browser. This subtask is database-independent.
Next, write a simple toy node app, which will read a single image data
as a blob from your database and save it to a local file. Make it work
so that when you click the file, you can actually open and view the image.
Finally, combine techniques you use in both subtasks to solve your
original problem.
I think you might also need the mime type of the image, unless they're
all in the same format (you'll probably discover it solving the first
sub-problem).
AFAIR, when reading blobs using node-firebird, I've always done it like
this:
data_buffer = await db.getBlobValue(resultset[0].field_name);
where "field_name" is the name of the blob field you select in your
query. However, I've used KOA (an async clone of express), so I could
await getBlobValue, because route handlers in KOA are async functions;
perhaps you need to use promise api to read the blob (i.e.
db.getBlobValue(...).then(...)) if your express route handlers are not
async.
regards
Tomasz