Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
function generateReport(site, data, type) {
let promise = new Promise((resolve, reject) => {
launchChromeAndRunLighthouse(v.url, {output: type})
.then((data) => {
data = JSON.stringify(data);
// timestamep will be used on the filename
let timeStamp = DateTime.local().toISODate();
// Directory may not exist yet
if (!fs.existsSync(`reports/${}`)) {
// Directory may not exist yet
if (!fs.existsSync(`reports/${}/${type}`)) {
fs.writeFile(`reports/${}/${}-${timeStamp}.${type}`, data);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.