Praveer Kumar
Praveer Kumar

Reputation: 1018

How to Read from a file using a Background Process in Electron App when File is modified?

I have an electron app which can be downloaded and installed from Microsoft store. I want to attach a background process with the electron app which(Background Process) will be monitoring a file. If the file is modified it will read some information from that file and send back to the renderer process.

I took https://github.com/felixrieseberg/electron-uwp-background as a reference but, unfortunately, not able to build background-task-registerer project. I logged issue https://github.com/felixrieseberg/electron-uwp-background/issues/4

I also referred to https://learn.microsoft.com/en-us/windows/uwp/launch-resume/create-and-register-an-inproc-background-task but did not get success.

Things I Did:

  1. Created a Background task component[Windows Runtime Component (Universal Windows)]
  2. Register Background task[Blank App (Universal Windows)]

when I double click on Package.appxmanifest and go to the Declarations tab->Available Declarations->Background Tasks, I do not see any property which is related to file property change.

Is there anyone who can guide me ? Thanks in advance.

Upvotes: 0

Views: 532

Answers (1)

Nico Zhu
Nico Zhu

Reputation: 32785

UWP does not provide such BackgroundTask to monitor file property change for long running. I think you could use TimeTrigger to monitor file regularly, But it can only execute once in 15 minutes. And the process should be implemented in the Background task component

Upvotes: 1

Related Questions