How to use the mkdir function from fs-promise

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

53
54
55
56
57
58
59
60
61
62
 *
 */
async createUploadDirectory() {
  const directoryExists = await fs.exists(this.uploadDir);
  if (!directoryExists) {
    await fs.mkdir(this.uploadDir);
  }
}

/**
fork icon20
star icon26
watch icon0

118
119
120
121
122
123
124
125
126
127
const archiveDir = path.dirname(archivePath);
const promise = Q.resolve(mkdirp(archiveDir))
  .then(() => checksum (fileHash) (filePath))
  .then(() => filePath)
  .catch(() => fsp.exists(archiveDir)
    .then(exists => !exists ? fsp.mkdir(archiveDir) : null)
    .then(() => download (url)(archivePath).onData(promise.onDataCallback))
    .then(() => hash("md5")(archivePath))
    .then(() => archiveHash ? checksum(archiveHash)(archivePath) : null)
    .then(() => extract (archivePath) (archiveDir))
fork icon7
star icon12
watch icon0

163
164
165
166
167
168
169
170
171
172
  return checksum(fileHash)(filePath);
}).then(function () {
  return filePath;
}).catch(function () {
  return fsp.exists(archiveDir).then(function (exists) {
    return !exists ? fsp.mkdir(archiveDir) : null;
  }).then(function () {
    return download(url)(archivePath).onData(promise.onDataCallback);
  }).then(function () {
    return hash("md5")(archivePath);
fork icon7
star icon12
watch icon0