How to use the mkdirsAsync function from fs-extra

Find comprehensive JavaScript fs-extra.mkdirsAsync code examples handpicked from public code repositorys.

188
189
190
191
192
193
194
195
196
197

let prepTasks = [];

// Create a new destination directory.
prepTasks.push(
  fs.mkdirsAsync(this.options.destination).then(() => {
    // Optionally, copy the contents of the builder's "kss-assets" folder.
    return fs.copyAsync(
      path.join(this.options.builder, 'kss-assets'),
      path.join(this.options.destination, 'kss-assets'),
fork icon293
star icon1
watch icon2

142
143
144
145
146
147
148
149
150
151

let initTasks = [];

// Create a new destination directory.
initTasks.push(
  fs.mkdirsAsync(this.config.destination).then(() => {
    // Optionally, copy the contents of the builder's "kss-assets" folder.
    return fs.copyAsync(
      path.join(this.config.builder, 'kss-assets'),
      path.join(this.config.destination, 'kss-assets'),
fork icon293
star icon0
watch icon2

30
31
32
33
34
35
36
37
38
39
const stat = new fs.Stats();
stat.mode = _modeFromEntry(entry);
stat.mtime = _mtimeFromEntry(entry);

if (stat.isDirectory()) {
  return fs.mkdirsAsync(path.join(dest, entry.fileName));
} else if (stat.isFile()) {
  return new Promise((resolve, reject) => {
    zip.openReadStream(entry, function(err, readStream) {
      if (err) return reject(err);
fork icon169
star icon0
watch icon2

210
211
212
213
214
215
216
217
218
219
        .then(() => this)
        .catch((e: Error) => logger.warn(e.message || e));
}

saveDataFileAsync() {
    return fs.mkdirsAsync(this._pluginConfig.path)
        .then(() => this._saveDataFile(fs.writeFileAsync));
}

saveDataFileSync() {
fork icon38
star icon4
watch icon4

127
128
129
130
131
132
133
134
135
136
.each(data => {
  const itemset_data = JSON.stringify(data.riot_json, null, 4);
  const folder_path = path.join(store.get('itemset_path'), data.champ, 'Recommended');
  const file_path = path.join(folder_path, `CIFY_${data.champ}_${data.source}_${data.file_prefix}.json`);

  return fs.mkdirsAsync(folder_path)
    .catch(err => Log.warn(err))
    .then(() => fs.writeFileAsync(file_path, itemset_data, 'utf8'))
    .catch(err => {
      throw new ChampionifyErrors.FileWriteError('Failed to write item set json file').causedBy(err);
fork icon169
star icon0
watch icon2

24
25
26
27
28
29
30
31
32
33

})
.then(function()
{
    // Create temp build directory if it doesn't already exist
    return fs.mkdirsAsync(options.buildDir);
})
.then(function()
{
    installDir = path.join(options.installBaseDir, options.productID);
fork icon94
star icon63
watch icon33

91
92
93
94
95
96
97
98
99
100

// copy generated handler so we can build directly from the source directory
const generatedHandler = path.join(webpackConfig.context, handlerFileName);

return fs.copyAsync(path.join(pathDist, handlerFileName), generatedHandler)
  .then(() => fs.mkdirsAsync(optimizedModulesPath))
  .then(() => runWebpack(webpackConfig))
  .then((stats) => {
    logStats(stats);
    const externals = getExternalsFromStats(stats);
fork icon28
star icon68
watch icon12

+ 3 other calls in file

87
88
89
90
91
92
93
94
95
96
if (top === null) {
  this.running = false
  return Promise.resolve()
}

return fse.mkdirsAsync(loc.chapterPath(this.path, top.mangaName, top.chapterNum))
  .then(() => this.isDownloadedImage(top.mangaName, top.chapterNum, top.url))
  .then((downloaded) => {
    if (!downloaded) {
      return this.downloadImage(top.mangaName, top.chapterNum, top.url, top.type)
fork icon2
star icon12
watch icon5

42
43
44
45
46
47
48
49
50
51
messageToSend.videoName = nameBuilder(startTime, SOURCE_ID);
var fileName = messageToSend.videoName + '.ts';
messageToSend.transactionId = new mongoose.Types.ObjectId();
messageToSend.startTime = startTime;
messageToSend.endTime = endTime;
fs.mkdirsAsync(fullPath)
        .then(function() {
                return fs.copyAsync(HARDCODED_FILE_PATH, path.join(fullPath, fileName));
        })
        .then(function() {
fork icon10
star icon7
watch icon26

75
76
77
78
79
80
81
82
83
84
function findLocaleFiles() {
  return BPromise.promisify(glob)('**/*.yml', { cwd: localesDir });
}

function ensureGeneratedLocalesDirectory() {
  return fs.mkdirsAsync(generatedLocalesDir);
}

function readLocaleFile(file) {
  return fs.readFileAsync(file, { encoding: 'utf8' });
fork icon0
star icon0
watch icon4

function icon

fs-extra.readFileSync is the most popular function in fs-extra (9724 examples)