Problem with SumRdmDde's "File Reader/Writer" system

I'm trying to use SRD's File Reading/Writing system, and it works just fine in playtesting, but when I test the deployed version, the game isn't able to create the file.

Here's the code that I'm using in my game to create the file.

Spoiler: Code
Code:
//Write Text File
var path = window.location.pathname.replace(/(\/www|)\/[^\/]*$/, '/data/key/');
if (path.match(/^\/([A-Z]\:)/)) {
    path = path.slice(1);
}
path = decodeURIComponent(path) + "MysticKey.wlgp";
var fs = require('fs');
fs.writeFile(path, "long_text_string_here", function(err) {
    if(err) {
        return console.log(err);
    }
});

This script is supposed to create a file in the "/data/key" folder of the game, and write some text into it.
However, while I have this running perfectly in playtesting, it doesn't work during a deployed game: no file gets created, and even if the file already exists, nothing gets written inside it.
Any suggestions? Any fixes I need to do with the code?

If you want me to provide a demo, feel free to ask, and I'll upload it when I'm able to.
1) where do you deploy to (PC or something else)?
2) have you encrypted the deployed game?
1) where do you deploy to (PC or something else)?
2) have you encrypted the deployed game?

I'm deploying to Windows.
The game doesn't create the file in both encrypted and non-encrypted deployment.
where is the folder with the game stored when you try that? It might be a folder restriction instead of a plugin problem
Well, I tried it in a few different folders, on the C and D disk drive, on Desktop, Documents, and other folders.
Doesn't work anywhere.

Original thread: https://forums.rpgmakerweb.com/threads/problem-with-sumrdmddes-file-reader-writer-system.77823/