Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

202
Vistas
Electron Blob MySQL

I would like to save and retrieve binary files from an mysql database in an Electron application. I am using mysql2/promise library to interface with mysql. I have created a binary blob base on hex and tried to send through IPC to main.js, from the index.html and prerender.js pages. However, when I send, it gives an error that the object cannot be cloned. I am unsure how to do this properly and am looking for guidance. Below is the partial code that I have been trying to test.

Main.js


    ipcMain.handle('saveBlob', async (event,data) => {
        const connection = await mysql.createConnection({
         host: 'localhost',
         database: 'somedb',
         user: 'blah',
         password : 'blah',
         port : xxxx
       }); 
    
     var parentId=1
     var result = await connection.execute("INSERT INTO somedb.files (parentId, 
     data) VALUES(?,?)", [parentId, data]);
     return result;
     })



prerender.js


const { contextBridge, ipcRenderer } = require('electron');
    
    contextBridge.exposeInMainWorld('electronAPI', {
        
        sendBlob: (ablob) => {
            ipcRenderer.invoke('saveBlob', ablob);
        }
    })


Index.html

var blob = new Blob([byteArray], {type: "application/octet-stream"});
window.electronAPI.sendBlob(blob);
about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda