mdf-reader
Version:
Reads MDF YAML and returns helpful accessors
33 lines (28 loc) • 817 B
JavaScript
import axios from 'axios';
import { MDFReader } from 'mdf-reader';
var model;
const yaml_urls = [
"https://raw.githubusercontent.com/CBIIT/htan-model/refs/heads/main/model-desc/htan-model.yaml",
"https://raw.githubusercontent.com/CBIIT/htan-model/refs/heads/main/model-desc/htan-model-props.yaml",
];
let ps = yaml_urls.map( (url) => {
return axios.get(url)
.then( (r) => { return r.data; } );
});
let p = Promise.all(ps)
.then( (results) => {
let dta = [];
results.forEach( (result) => {
dta.push(result);
});
return dta;
})
.then( (dta) =>
{ return new MDFReader(...dta); }
)
.catch( (e) => { throw new Error(e); } );
p.then( (model) => {
model.nodes().forEach( (n) => {
console.log("Node name: %s", n.handle);
});
});