當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。