I want to store PDF using PostgreSQL bytea in Node.js
How can I convert PDF to datatype bytea ?
My code is:
request.get('https://www.cbconnexus.com/upload/settings/black/data.pdf', function (error, response, body) {
if (!error && response.statusCode == 200) {
data = "data:" + response.headers["content-type"] + ";base64," + Buffer.from(body).toString('base64');
console.log(data);
}
});
A node http server accepting a post of a PDF and storing it in a postgresql table. Listens on fixed IP address 192.168.1.3, port 8888 by default but you can specify the port as the first parameter. Uses pg and formidable.