Writing .bin after output is complete

This commit is contained in:
Richard Ramos 2018-07-23 13:29:13 -04:00
parent 74fbf9d046
commit 31b2cfc7f6
1 changed files with 16 additions and 7 deletions

View File

@ -65,19 +65,28 @@ function compileSolc(embark, contractFiles, cb) {
compiled_object[className].abiDefinition = JSON.parse(contract.abi);
compiled_object[className].filename = fileName;
if(outputBinary){
fs.writeFile(outputDir + className + ".bin", contract.bin, (err) => {
if (err) logger.error(err);
});
}
}
fileCb();
});
},
function (err) {
cb(err, compiled_object);
cb(err, compiled_object);
embark.events.on("outputDone", function() {
if(outputBinary){
Object.keys(compiled_object).map(function(className, index) {
fs.writeFile(outputDir + className + ".bin", compiled_object[className].bin, (err) => {
if (err) {
logger.error("Error writing binary file: " + JSON.stringify(err));
}
});
});
}
});
});
}