当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript fs-extra.outputJson函数代码示例

本文整理汇总了TypeScript中fs-extra.outputJson函数的典型用法代码示例。如果您正苦于以下问题:TypeScript outputJson函数的具体用法?TypeScript outputJson怎么用?TypeScript outputJson使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了outputJson函数的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: next

gulp.task('settings:reset', (next) => {
    const s = JSON.parse(JSON.stringify(settings));
    s.env = 'dev';
    s.mock = false;
    fs.outputJson('./src/assets/settings.json', s, { spaces: 4 })
        .then(() => next());
});
开发者ID:acaprojects,项目名称:a2-widgets,代码行数:7,代码来源:default.ts

示例2: mergeJSON

gulp.task('settings:update', (next) => {
    const s = JSON.parse(JSON.stringify(settings));
    mergeJSON(s, prod_settings);
    s.mock = !!argv.mock || (argv.demo && argv.demo !== 'false');
    s.env = !!argv.prod ? 'prod' : 'dev';
    fs.outputJson('./src/assets/settings.json', s, { spaces: 4 })
        .then(() => next());
});
开发者ID:acaprojects,项目名称:a2-widgets,代码行数:8,代码来源:default.ts

示例3: Boolean

    Object.keys(availableLanguages).map(async (availableLanguage) => {
      const messagesJsonStr = await transifex.translationInstanceMethodAsync(
        projectSlug,
        resourceSlug,
        availableLanguage,
        {mode: 'onlytranslated'}
      )
      const messagesJson: Messages = JSON.parse(messagesJsonStr)

      const sortedMessagesJson = Object.keys(messagesJson)
        .filter((key) => Boolean(R.path([key, 'message'], messagesJson)))
        .sort()
        .reduce((obj: Messages, key) => {
          // trim message
          if (messagesJson[key].message) {
            messagesJson[key].message = messagesJson[key].message.trim()
          }

          return {
            ...obj,
            [key]: messagesJson[key]
          }
        }, {})

      let mappedLanguage = ''
      switch (availableLanguage) {
        case 'nb_NO':
          mappedLanguage = 'nb'
          break

        default:
          mappedLanguage = availableLanguage
      }

      await fs.mkdirs(path.join(localesPath, mappedLanguage))

      await fs.outputJson(
        path.join(localesPath, mappedLanguage, 'messages.json'),
        sortedMessagesJson,
        {spaces: 2}
      )

      console.log(`"${mappedLanguage}" is generated`)
    })
开发者ID:foray1010,项目名称:Popup-my-Bookmarks,代码行数:44,代码来源:generateLocalesFromTransifex.ts

示例4:

fs.mkdirp(dir).then(() => {
	// stub
});
fs.mkdirs(dir, errorCallback);
fs.mkdirsSync(dir);
fs.mkdirp(dir, errorCallback);
fs.mkdirpSync(dir);

fs.outputFile(file, data).then(() => {
	// stub
});
fs.outputFile(file, data, errorCallback);
fs.outputFileSync(file, data);

fs.outputJson(file, data, {
	spaces: 2
}).then(() => {
	// stub
});
fs.outputJson(file, data, {
	spaces: 2
}, errorCallback);
fs.outputJSON(file, data, errorCallback);
fs.outputJSON(file, data).then(() => {
	// stub
});

fs.outputJsonSync(file, data);
fs.outputJSONSync(file, data);

fs.readJson(file).then(() => {
开发者ID:gilamran,项目名称:DefinitelyTyped,代码行数:31,代码来源:fs-extra-tests.ts

示例5:

);
fs.createFile(file, errorCallback);
fs.createFileSync(file);

fs.mkdirs(dir, errorCallback);
fs.mkdirs(dir, {}, errorCallback);
fs.mkdirsSync(dir);
fs.mkdirsSync(dir, {});
fs.mkdirp(dir, errorCallback);
fs.mkdirp(dir, {}, errorCallback);
fs.mkdirpSync(dir);
fs.mkdirpSync(dir, {});

fs.outputFile(file, data, errorCallback);
fs.outputFileSync(file, data);
fs.outputJson(file, data, errorCallback);
fs.outputJSON(file, data, errorCallback);

fs.outputJsonSync(file, data);
fs.outputJSONSync(file, data);

fs.readJson(file, (error: Error, jsonObject: any) => {});
fs.readJson(file, readOptions, (error: Error, jsonObject: any) => {});
fs.readJSON(file, (error: Error, jsonObject: any) => {});
fs.readJSON(file, readOptions, (error: Error, jsonObject: any) => {});

fs.readJsonSync(file, readOptions);
fs.readJSONSync(file, readOptions);

fs.remove(dir, errorCallback);
fs.removeSync(dir);
开发者ID:YousefED,项目名称:DefinitelyTyped,代码行数:31,代码来源:fs-extra-tests.ts

示例6:

 return Promise.resolve().then(() => fs.outputJson(filename, value, { spaces: "\t", EOL: "\r\n", replacer } as any));
开发者ID:kencinder,项目名称:steam-rom-manager,代码行数:1,代码来源:write.ts

示例7: Promise

 return new Promise((resolve, reject) => {
   fs.outputJson(dirHelper("notes.noam"), newData, function(err) {
     if (err) reject(err);
     resolve();
   });
 });
开发者ID:zakarhino,项目名称:noam,代码行数:6,代码来源:saveNote.ts


注:本文中的fs-extra.outputJson函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。