fs#mkdir JavaScript Examples

The following examples show how to use fs#mkdir. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: js.js    From ucompress with ISC License 6 votes vote down vote up
saveCode = (source, dest, code, options) =>
  new Promise((res, rej) => {
    dest = uModules(dest);
    mkdir(dirname(dest), {recursive: true}, err => {
      /* istanbul ignore if */
      if (err)
        rej(err);
      else {
        writeFile(dest, code, err => {
          /* istanbul ignore if */
          if (err)
            rej(err);
          else if (options.createFiles)
            compress(source, dest, 'text', options)
              .then(() => res(dest), rej);
          else
            res(dest);
        });
      }
    });
  })