Writing to an external file from canvas

Hi,
the extension I’m writing should be able to write data generated using the ElementRegistry to an external file. e.g. a combination of task IDs and task labels.
I know that I can use the ‘brfs’ module to read files from the hard drive, but as bpmn-io is pretty much running in a web browser it is not easy to write to the disk.
It should be possible to do it using the Electron framework, but i can not access the name ‘electronApp’ when I’m in the context of the canvas. (I don’t know how to describe it better. If you don’t understand what I mean, I’ll try again)
So is there an easy way to do this, that I am missing? Any hints on where I should look?

With the extension are you referring to a Camunda Modeler plugin?

Yes, I’m referring to a Camunda Modeler plugin. Thanks for the clarification.

So the solution for my problem was quite simple, although I don’t know if it is the best solution.

Using browserify you can’t really do IO with NodeJS (or use require to be more precise). So you can’t do
var fs = require('fs');
But you can circumvent what browserify is doing by using this:
var fs = window.require('fs');

The rest should be quite clear:

fs.writeFile('data.json', JSON.stringify(ParsingObject), {flag: 'w'}, function(err){
    if(err){
      console.log(err);
    } else {
    console.log('File was saved');`
}

I don’t fully understand what the keyword / object window allows you to do, but from what I can see, it gives you access to various NodeJS and probably Electron features that you can’t use in a webbrowser and that are therefore stripped away by browserify.