How to use the mkdirAsync function from fs

Find comprehensive JavaScript fs.mkdirAsync code examples handpicked from public code repositorys.

12
13
14
15
16
17
18
19
20
21
22
const librariesPath = path.join(ideaPath, 'libraries');
const librariesLocalDataPath = path.join(__dirname, 'data/libraries/shang_auto_generate.xml');
const librariesName = 'shang_auto_generate.xml';


function ensureTypingDir() {
  return fs.mkdirAsync(autoGenerateDir)
    .catch(function (e) {
      if (e.code === 'EEXIST') {
        return Promise.resolve();
      }
fork icon0
star icon0
watch icon0

+ 3 other calls in file

36
37
38
39
40
41
42
43
44
45
  await fs.statAsync(uploadsFolder);
} catch (e) {
  if (e && e.code == "ENOENT") {
    console.log("The uploads folder doesn't exist, creating a new one...");
    try {
      await fs.mkdirAsync(uploadsFolder);
    } catch (err) {
      console.log("Error creating the uploads folder 1");
      return false;
    }
fork icon0
star icon0
watch icon0