code: function mkpath(dir, cb) {
    dir = path.normalize(dir);
    var segs = dir.split(path.sep);
    var made = "";
    async.eachSeries(
        segs,
        function(seg, cb) {
          if (made.length || !seg.length) {
            made += "/";
          }
          made += seg;
          fs.exists(made, function(exists) {
            if (!exists) {
              fs.mkdir(made, function(err) {
                if (err && err.code === "EEXIST") {
                  err = null; 
                }
                cb(err);
              });
              return;
            }
            fs.stat(made, function(err, stat) {
              if (err) {
                cb(err);
              } else if (stat.isDirectory()) {
                cb(null);
              } else {
                cb(new Error("Cannot create " + made + " (in " + dir + ") because it exists and is not a directory", "ENOENT"));
              }
            });
          });
        },
        function(err) {
          cb(err);
        });
  }
docs: Creates a dir
  @param dir
  @param cb