datainout
Version:
Import and reports data
45 lines (43 loc) • 1.11 kB
JavaScript
var __async = (__this, __arguments, generator) => {
return new Promise((resolve, reject) => {
var fulfilled = (value) => {
try {
step(generator.next(value));
} catch (e) {
reject(e);
}
};
var rejected = (value) => {
try {
step(generator.throw(value));
} catch (e) {
reject(e);
}
};
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
step((generator = generator.apply(__this, __arguments)).next());
});
};
// src/reporters/exporters/Html.exporter.ts
import * as ejs from "ejs";
var HtmlExporter = class {
constructor(templatePath) {
this.templatePath = templatePath;
}
write(reportPath, data) {
return __async(this, null, function* () {
ejs.render(this.templatePath, data);
});
}
toBuffer(data) {
return __async(this, null, function* () {
return Buffer.from(ejs.render(this.templatePath, data));
});
}
streamTo(...args) {
throw new Error("Stream Method don't support for html.");
}
};
export {
HtmlExporter
};