How to use the ensureDirAsync function from fs-extra

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

90
91
92
93
94
95
96
97
98
99
]

// *** TOOLS & COMMON METHODS ***
const downloadAsync = async (url, destDir, filename = path.basename(url), description) => {
  log(`Downloading ${description} from ${url}`)
  await fs.ensureDirAsync(destDir)
  const destPath = path.join(destDir, filename)
  try {
    await fs.accessAsync(destPath, fs.R_OK)
    log(`Use existing ${destPath}`)
fork icon356
star icon0
watch icon1

165
166
167
168
169
170
171
172
173
174
const runtime = target.function.runtime

return this.wrap(wrapperDir, wrapperPy, this.libSubDir, target.realHandler).bind(this)
  .then(_.partial(this.fileAccessable, Path.join(wrapperDir, 'requirements.txt'))).bind(this)
  .then(_.partial(this.hard_remove, [wrapperPy, packagePath]))
  .then(() => { return Fse.ensureDirAsync(packagePath); })
  .then(() => {
    return Fse.copyAsync(
      Path.join(__dirname, 'requirements.py'), requirementsPy);
  }).bind(this)
fork icon16
star icon25
watch icon3

67
68
69
70
71
72
73
74
75
76
/**
 * i18n
 */
() => {
  console.info(colors.white('  └── ') + colors.green('Copying i18n client files...'))
  return fs.ensureDirAsync('./assets/js/i18n').then(() => {
    return fs.readJsonAsync('./server/locales/en/browser.json').then(enContent => {
      return fs.readdirAsync('./server/locales').then(langs => {
        return Promise.map(langs, lang => {
          console.info(colors.white('      ' + lang + '.json'))
fork icon0
star icon1
watch icon4

+ 3 other calls in file

60
61
62
63
64
65
66
67
68
69
70
71
72
  },
};




function ensureTypingDir(config) {
  return fs.ensureDirAsync(config.path);
}


function getServicesDeclare(config) {
  return getFiles(config.path)
fork icon0
star icon0
watch icon0

+ 6 other calls in file

70
71
72
73
74
75
76
77
78
79
    return jobs;
  })());

const downloadAsync = async (url, destDir, filename = path.basename(url), description) => {
  log(`Downloading ${description} from ${url}`);
  await fs.ensureDirAsync(destDir);
  const destPath = path.join(destDir, filename);
  try {
    await fs.accessAsync(destPath, fs.R_OK);
    log(`Use existing ${destPath}`);
fork icon0
star icon0
watch icon2

+ 3 other calls in file

function icon

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