code: function ensureDir(dir) {
    return new Promise((resolve, reject) => {
      try {
        FS.ensureDirSync(dir);
        resolve(dir);
      } catch (err) {
        reject(err);
      }
    });
  }
docs: Ensures that the directory exists.
  @param {String} dir