Get bytes total and loaded of query - progress bar


quick question…
is there any way to detect (or calculate) the size of a query/queries?
i was an ActionScript developer and there you have some methods like getBytesLoaded and getBytesTotal to build my own progress bar. i’d like to know the “wieght” of each query, because i perform several queries to update my sqlite database (500k+ records in total), just to let the user know that “something is happening in background” :sunglasses:

thank you


Database engines generally don’t measure data transfer like HTTP does, especially in your case of SQLite which is not even using a network connection. I think your best bet is to update your progress bar after each record (or after a certain batch size of them) is processed. Once you issue a query to the database you usually have no way of knowing what the state of things are until you get a response back from the database engine’s API.

It’s worth bearing in mind that some systems support having a progress bar on the icon in the taskbar. So you might want to use that in your app too:

Another option is just to display an animated spinner to reassure the user that the application has not frozen.


I’ve been trying to update my progress bar (from bootstrap) but i have to send the progress via ipc like:
i was using a console log to show the progress, but it shows everything only when it’s done… :confused:


Only getting output once everything is done sounds like your app was suffering from the process being blocked due to heavy workload. I’m guessing that could be solved by using asynchronous calls where possible or by offloading the work to another process (either another hidden browser window or by forking the main NodeJS process).

Yes, unfortunately you can’t easily avoid IPC messages. That’s the way Electron communicates between UI windows and background processes.


actually the “heavy weight” is on a soap web service that retrive a “kinda” JSON file with all the query that must be executed and wrap them into a transaction.
the idea of putting a progress bar is because the app is going to increase the number of queries (tables and data) and i’d like to know if everything is working (and either making it look good) :wink: