0

I have a Chrome extension that reads some info (small portions of text) from webpages using content scripts, then sends it to background script. Then background script must make that info available for other non-Chrome apps (in my current case it's a local Node.js app using Discord.js). And that must work silently and automatically.

After some research I've decided that the best way to share info is plain text files. Chrome saves them, Node reads them. So we come to the question in header - is there any way to just save small text files somewhere on the local drive? If it neccessarily requires a packaged app, I can create it and exchange messages with the extension, no problem.

I see no security hole here. I don't want no self-modifying code, need only one isolated place on drive where I will store files. Also, this extension is for my private use (my Discord channel automation).

Also please tell me if the whole scheme I have in mind is impossible to implement. Don't want to be stuck in the dead end.

Thank you!

Pavel Ooo
  • 63
  • 1
  • 2
  • 8
  • Only chrome apps in kiosk mode can use chrome.fileSystem API, which is not really a usable solution. The only friction-free solution is to write a separate utility and invoke it via [nativeMessaging](https://developer.chrome.com/extensions/nativeMessaging). With this you can even avoid writing the files and just run your node.js script directly from the extension. – wOxxOm May 31 '20 at 14:04
  • Hi @wOxxOm. Did you mean native client C++ app by "separate utility"? – Pavel Ooo Jun 09 '20 at 17:44
  • You can use any language, C++ too. – wOxxOm Jun 09 '20 at 19:27
  • @wOxxOm , Sorry for newbie questions but I just can't grasp how this solution could work... Did you mean it to neccessarily be a native client app running inside of Chrome? Or it could be a Windows app? Also, if I can run node.js script directly from the extension (as you said above), why would I need separate utility? Maybe you meant that extension calls utility, and it in turn calls node.js script? – Pavel Ooo Jun 10 '20 at 19:58
  • Yes, running a "node.js script directly" means launching it via nativeMessaging API. "Directly" here was used to indicate you won't need intermediate files. – wOxxOm Jun 11 '20 at 03:43
  • @wOxxOm, YES! Thank you VERY much, that worked. I created a tiny .NET app that received data from stdin and passed it further to my node.js script. – Pavel Ooo Jun 14 '20 at 12:10

0 Answers0