code: function writeDB(path, jsonStr)
  {
      const rootPath = dirname(path);
      return statAsync(rootPath)
          .then((stats) =>
          {
              if(!stats.isDirectory())
              {
                  throw new WriteDatabaseError("Root path " + JSON.stringify(rootPath) + " is not a directory!", path);
              } // end if
          })
          .catch((error) => { return error.code === 'ENOENT'; }, () => mkdirp(rootPath))
          .then(() => writeFileAsync(path, jsonStr));
  }
docs: end readDB