How to use the fs.writeFileSync function in fs

To help you get started, we’ve selected a few fs examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github hyperledger-archives / caliper / src / gui / src / demo.js View on Github external
demoAddLatency(deMax, deMin, deAvg);
        }

    }

    demoRefreshX();

   // if(started) {
        console.log('[Transaction Info] - Submitted: ' + demoData.summary.txSub
        + ' Succ: ' + demoData.summary.txSucc
        + ' Fail:' +  demoData.summary.txFail
        + ' Unfinished:' + (demoData.summary.txSub - demoData.summary.txSucc - demoData.summary.txFail));
   // }

    var fs = require('fs');
    fs.writeFileSync(demoFile,  JSON.stringify(demoData));
}
github w3c-webdriver / w3c-webdriver / packages / w3c-webdriver / test-env / JasmineJUnitReporter.ts View on Github external
public jasmineDone() {
    const duration = Date.now() - this.jasmineStartTime;

    writeFileSync(
      this.outputFile,
      xml({
        testsuites: [
          {
            testsuite: [{ _attr: { time: duration / 1000 } }, ...this.testcases]
          }
        ]
      }),
      'utf8'
    );
  }
github semantic-ui-forest / forest-templates / scripts / upgrade-html.js View on Github external
let content, srcHtmlPath, destHtmlPath;

  const oldSemanticUIVersion = process.argv[2];
  const newSemanticUIVersion = process.argv[3];

  for (let category of ["bootstrap", "semantic-ui"]) {
    for (let template of fs.readdirSync(category)) {
      console.log(
        `Upgrade ${category}/${template} html semantic to from` +
        ` ${oldSemanticUIVersion} to ${newSemanticUIVersion}...`
      );
      srcHtmlPath = path.join(category, template, "html/index.html");
      destHtmlPath = path.join(category, template, "html/index.html");
      content = fs.readFileSync(srcHtmlPath, "utf-8");
      fs.writeFileSync(
        destHtmlPath,
        content.replace(
          `semantic-ui/${oldSemanticUIVersion}/semantic.min.css`,
          `semantic-ui/${newSemanticUIVersion}/semantic.min.css`
        )
      );
    }
  }
}
github probmods / webppl / src / params / store / file.js View on Github external
function write(params, id) {
  try {
    fs.writeFileSync(filename(id), serialize.serializeParams(params));
    if (verbose) {
      console.log('Wrote parameter set ' + id + '.');
    }
  } catch (e) {
    util.warn('Error writing parameter set ' + id + '.');
  }
}
github cheeaun / busrouter-sg / tasks / geojsonRoutes.js View on Github external
features.push({
      type: 'Feature',
      properties: {
        number: no,
        route: i,
      },
      geometry: {
        type: 'LineString',
        coordinates: route,
      },
    });
  });
});

const filePath = 'data/3/routes.geojson';
fs.writeFileSync(filePath, JSON.stringify({
  type: 'FeatureCollection',
  features,
}, null, '\t'));
console.log(`Generated ${filePath}`);
github Dart-Code / Dart-Code / src / extension / analysis / analyzer_status_reporter.ts View on Github external
### Analyzer Info

The analyzer was launched using the arguments:

${analyzerArgs.map((a) => `- ${a}`).join("\n")}

### Exception${error.isFatal ? " (fatal)" : ""}

${error.message}

${error.stackTrace.trim()}
`;

		const fileName = `bug-${getRandomInt(0x1000, 0x10000).toString(16)}.md`;
		const tempPath = path.join(os.tmpdir(), fileName);
		fs.writeFileSync(tempPath, data.trim());
		workspace.openTextDocument(tempPath).then((document) => {
			window.showTextDocument(document);
		});
	}
}
github nfarina / homebridge / lib / config.js View on Github external
save() {
    fs.writeFileSync(this.path, JSON.stringify(this.data, null, 2));
  }
}
github annexare / Countries / gulpfile.js View on Github external
exports[DO_COPY] = function copy(callback) {
  fs.writeFileSync(`${DIST}${CONTINENTS}.${JSON_EXT}`, JSON.stringify(continents, false, JSON_TAB) + LF);
  fs.writeFileSync(`${DIST}${COUNTRIES}.${JSON_EXT}`, JSON.stringify(countries, false, JSON_TAB) + LF);
  fs.writeFileSync(`${DIST}${LANGUAGES}.${JSON_EXT}`, JSON.stringify(languagesInUse, false, JSON_TAB) + LF);
  fs.writeFileSync(`${DIST}${LANGUAGES}.${ALL}.${JSON_EXT}`, JSON.stringify(languages, false, JSON_TAB) + LF);
  callback && callback();
}
github Haufe-Lexware / wicked.haufe.io / src / env / src / config-updater.js View on Github external
function saveKickstarter(config, kickData) {
    debug('saveKickstarter()');
    fs.writeFileSync(path.join(config.basePath, 'kickstarter.json'), JSON.stringify(kickData, null, 2));
}
github takuyaa / kuromoji.js / gulpfile.js View on Github external
const tid_pos_buffer = toBuffer(dic.token_info_dictionary.pos_buffer.buffer);
        const tid_map_buffer = toBuffer(dic.token_info_dictionary.targetMapToBuffer());
        const connection_costs_buffer = toBuffer(dic.connection_costs.buffer);
        const unk_buffer = toBuffer(dic.unknown_dictionary.dictionary.buffer);
        const unk_pos_buffer = toBuffer(dic.unknown_dictionary.pos_buffer.buffer);
        const unk_map_buffer = toBuffer(dic.unknown_dictionary.targetMapToBuffer());
        const char_map_buffer = toBuffer(dic.unknown_dictionary.character_definition.character_category_map);
        const char_compat_map_buffer = toBuffer(dic.unknown_dictionary.character_definition.compatible_category_map);
        const invoke_definition_map_buffer = toBuffer(dic.unknown_dictionary.character_definition.invoke_definition_map.toBuffer());

        fs.writeFileSync("dict/base.dat", base_buffer);
        fs.writeFileSync("dict/check.dat", check_buffer);
        fs.writeFileSync("dict/tid.dat", token_info_buffer);
        fs.writeFileSync("dict/tid_pos.dat", tid_pos_buffer);
        fs.writeFileSync("dict/tid_map.dat", tid_map_buffer);
        fs.writeFileSync("dict/cc.dat", connection_costs_buffer);
        fs.writeFileSync("dict/unk.dat", unk_buffer);
        fs.writeFileSync("dict/unk_pos.dat", unk_pos_buffer);
        fs.writeFileSync("dict/unk_map.dat", unk_map_buffer);
        fs.writeFileSync("dict/unk_char.dat", char_map_buffer);
        fs.writeFileSync("dict/unk_compat.dat", char_compat_map_buffer);
        fs.writeFileSync("dict/unk_invoke.dat", invoke_definition_map_buffer);

        done();
    });
});

fs

This package name is not currently in use, but was formerly occupied by another package. To avoid malicious use, npm is hanging on to the package name, but loosely, and we'll probably give it to you if you want it.

ISC
Latest version published 8 years ago

Package Health Score

70 / 100
Full package analysis