-
Notifications
You must be signed in to change notification settings - Fork 1
Guides
Moop204 edited this page Mar 10, 2021
·
1 revision
How to do things.
With Existing File Make a Parser object and give it the contents of a CellML file as a string. Run .parseModel() with the argument being the content of the file. \
const fs = require('fs');
const parser = new libcellml.Parser();
const file = fs.readFileSync('src/file', 'utf8');
const model = parser.parseModel(file);
From Scratch [idk]
Make a Printer object and give it a model.
const printer = new libcellml.Printer();
const newContent = printer.printModel(model);
fs.writeFile("newFile.xml", newContent, (err) => {
if(err) console.log("Failed to write to file");
else console.log("Successfully wrote to file");
}