How to embed and run .dtf file from an electron app

38 Views Asked by At

I'm working on an Electron app that will use Vue for the front-end. For this app I have a cloud database that is powered by supabase and that will have an initial dataset imported from a cvs file. To mantain the data updated I need to do a massive update on two tables and this doesn't seems to be a problem, my main problem at the moment is how I can run an IBM Data Transfer file from the electron app that will generate an excel file every time the application is opened. At the moment I've tried to use the execFile node function into the background.js file of my app, but without success.

childProcess.execFile('./suppliers.dtf', (error, stdout, stderr) => { ... }) 

The application will give an error due to the format of the file that will be not recognized. My idea is to embed the needed dtf files inside the electron app, and generate the excel files inside the folder where the compiled application will be stored on the user pc. How I can accomplish this and how I can run the dtf file using nodejs?

UPDATE

I've tried alsto to use spawn but nothing occur. According to the ibm documentation, to run the file I need to pass the \s argument and the file to run. I've noticed that the path to the file will omit the slashes \

this is the code I've tried, in console no error is logged

        const supplierDTF = "C:\Users\user1\Desktop\riftool\src\dtf\fornitori.dtf"

        let dtf = childProcess.spawn("C:\Program Files (x86)\IBM\Client Access\rtopcb.exe", ['-s', supplierDTF ])
console.log(dtf)

In the console log the path to the executable file looks like spawnfile: 'C:Program Files (x86)IBMClient Access\rtopcb.exe'

No idea of how to fix this

0

There are 0 best solutions below