Home » Javascript » How do I send image file with nedb

How do I send image file with nedb

Posted by: admin August 19, 2018 Leave a comment


I using nedb.

How do I image upload?

I’m trying this code.

But, there is no saved evidence.

const Nedb = require('nedb');
const path = require('path');
const { remote } = require('electron');

const dbPath = remote.app.getPath('userData');
const users = new Nedb({
  autoload: true,
  filename: path.join(dbPath, 'users.db'),

// upload something image file.
document.querySelector('input[type=file]').addEventListener('change', (evt) => {
  const file = evt.target.files[0];

  users.insert(file, (err, docs) => {
    console.log(docs); // `{"_id": "hash value"}` only data


I want to save for binary data.

Please tell me image upload with nedb.