i'm trying to insert file from buffer i've got from multer into sqlite3 using nodejs, multer, and sqlite3.
The code :
let sql2 = `
INSERT INTO tb_berkas (nama_berkas, hari_input, tgl_input, bulan_input, tahun_input, jam_input, menit_input, ukuran, file)
VALUES (
'${this.req.file.originalname}', '${new Date().toLocaleString("id", {weekday:"long"})}', '${new Date().getDate()}',
'${new Date().toLocaleString("id", {month:"long"})}', '${new Date().getFullYear()}', '${new Date().getHours()}',
'${new Date().getMinutes()}', '${this.req.file.size}', '${Buffer.from(this.req.file.buffer, 'binary')}'
)
`
function query2(cb) {
koneksi.run(sql2, (err2, result2) => {
if(err2) {
throw err2;
} else {
cb(null, result2);
}
})
}
The code return error like this :
i'm desperate to solve this problem. please, let me know i you guys found the solution.