Check and Create folders

Hello. I wanted to see if there was a possibility to make a plugin that would check for specific folders on startup and if they don't exist, to create them.

Think of this as a custom folder checker for your game. It would check for folders that you specify and if it doesn't exist, would create them before loading ANYTHING.

What I am hoping for, is a way to reduce simple dev errors when deploying without these folders.

Thanks!
.. no need plugin for this.

PHP:
var path = require('path'),
    fs = require('fs');

function ensureDirectoryExistence(filePath) {
  var dirname = path.dirname(filePath);
  if (fs.existsSync(dirname)) {
    return true;
  }
  ensureDirectoryExistence(dirname);
  fs.mkdirSync(dirname);
}

work only for pc distribution with app.
Not work on web client or android for security reason.
.. no need plugin for this.

PHP:
var path = require('path'),
    fs = require('fs');

function ensureDirectoryExistence(filePath) {
  var dirname = path.dirname(filePath);
  if (fs.existsSync(dirname)) {
    return true;
  }
  ensureDirectoryExistence(dirname);
  fs.mkdirSync(dirname);
}

work only for pc distribution with app.
Not work on web client or android for security reason.

What do i do with this?
Where do i add it?
Bumping...

Original thread: https://forums.rpgmakerweb.com/threads/check-and-create-folders.98175/