How to use the outputJSONSync function from fs-extra

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

17
18
19
20
21
22
23
24
25
26
27
    path = require("path");


let writeJSONToDiskSync = (path, JSONData) => {
    let fd;
    try {
        fs.outputJSONSync(path, JSONData);
        fd = fs.openSync(path, 'rs+');
        fs.fdatasyncSync(fd);
        return true;
    } catch (e) {
fork icon0
star icon2
watch icon0

9
10
11
12
13
14
15
16
17
18
19
20
const output = solc.compile(source, 1).contracts;


fs.ensureDirSync(buildPath); // create a build folder if that folder doesn't exists


for (let contract in output) {
  fs.outputJSONSync(
    path.resolve(buildPath, contract.replace(":", "").concat(".json")),
    output[contract]
  );
}
fork icon0
star icon0
watch icon0

+ 3 other calls in file

function icon

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