How to use the ensureDir function from fs-promise

Find comprehensive JavaScript fs-promise.ensureDir code examples handpicked from public code repositorys.

57
58
59
60
61
62
63
64
65
66
67
// Write the '.oathframe.json' file for this directory.
Directory.writeJSON = function(data, options) {
  options = options || {};
  options = Object.assign({encoding:'utf8'}, options);


  return fs.ensureDir(this.filepath())
    .then(() => fs.writeFile(this.physicalFilepath(), JSON.stringify(data), options))
    .then(() => {
      console.error('Wrote: ' + this.filepath() + path.sep);  // eslint-disable-line no-console
      return this;
fork icon0
star icon1
watch icon0