How to use the readJsonAsync function from fs-extra

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

68
69
70
71
72
73
74
75
76
77
 * 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'))
          let outputPath = path.join('./assets/js/i18n', lang + '.json')
fork icon0
star icon1
watch icon4

+ 3 other calls in file

73
74
75
76
77
78
79
80
81
82
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'))
      let outputPath = path.join('./assets/js/i18n', lang + '.json')
      return fs.readJsonAsync(path.join('./server/locales', lang + '.json'), 'utf8').then((content) => {
        return fs.outputJsonAsync(outputPath, _.defaultsDeep(content, enContent))
      }).catch(err => { // eslint-disable-line handle-callback-err
        return fs.outputJsonAsync(outputPath, enContent)
      })
fork icon0
star icon0
watch icon2

+ 3 other calls in file

22
23
24
25
26
27
28
29
30
31
  })
}).then(() => {
  /**
   * Fetch version from npm package
   */
  return fs.readJsonAsync('package.json').then((packageObj) => {
    let versionGet = _.chain(packageObj.version).split('.').take(4).join('.')
    let remoteURL = _.replace('https://github.com/Requarks/wiki/releases/download/v{0}/wiki-js.tar.gz', '{0}', versionGet)

    return new Promise((resolve, reject) => {
fork icon0
star icon0
watch icon2

function icon

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