mysqlnode.jsexpressnode-mysql2

NodeJS - How to insert a blob image in MySQL


I have a list of int representing the hexa code or int8 of a picture, that I need to insert to MySQL as Blob. I am using a NodeJS Express server to do this, in an API. I am using the node packet node-mysql2, my NodeJS version is NodeJS 12.

So my API receive this : [137,80,78,71,13,10,26,10,0,0,0,...96,130]

I want to insert this as Blob in MYSQL (this is a picture). How can I do this please ? I didn't found anything... I've done a lot of StackOverflow subjects and Google pages but I did not found.

Thanks by advance for the help !


Solution

  • The answer is: Don’t do that! You should store a reference to a blob storage entry where you can save the blob data.