analytics-reporter
Version:
A lightweight command line tool for reporting and publishing analytics data from a Google Analytics account.
20 lines (16 loc) • 419 B
JavaScript
const fs = require("fs")
const path = require("path")
const publish = (report, results, { output, format }) => {
const filename = `${report.name}.${format}`
const filepath = path.join(output, filename)
return new Promise((resolve, reject) => {
fs.writeFile(filepath, results, err => {
if (err) {
reject(err)
} else {
resolve()
}
})
})
}
module.exports = { publish }