Combines project.json in smartface workspace environment In a provided path scans the directory for name matching project.json OR project..json files and combines them.
npm i --save project-json-combiner
Require the module first
var projectJSONCombiner = require("project-json-combiner");
- fs object must be passed
- Scans folder non-recursivly
- File names are case sensitive "project**.<anySingleWord>**.json"
- It has built in caching mechanisim
var fs = require("fs");
projectJSONCombiner.getProjectJSON("./", fs, function(err, projectJSON){
// handle error if any
console.log(projectJSON.info.name);
}) ;
In case of malformatted json files, JSON parser will throw errors. That first encountered error will trigger the callback with that information. The error object passed also contains currentFile
property stating which file is faulty.
Caching is enabled by default.
projectJSONCombiner.cache.enabled = false; //or true
Object is cached for duration of 1 second by default Caching is enabled by default.
projectJSONCombiner.cache.duration = 5000; //in miliseconds