StackGenVis: Alignment of Data, Algorithms, and Models for Stacking Ensemble Learning Using Performance Metrics https://doi.org/10.1109/TVCG.2020.3030352
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
StackGenVis/frontend/node_modules/sane-topojson/bin/stats.js

60 lines
1.4 KiB

var fs = require('fs')
var gzipSize = require('gzip-size')
var prettySize = require('prettysize')
var common = require('./common')
fs.readFile(common.pathToConfig, 'utf8', main)
function main (err, configFile) {
if (err) throw err
var config = JSON.parse(configFile)
var toposToWrite = common.getToposToWrite(config)
var readBar = common.makeBar(
'Measuring topojson size: [:bar] :current/:total',
[toposToWrite]
)
var header = [
'# sane-topojson file stats',
'',
'| dist name | raw size | gzip size |',
'| --------- | -------- | --------- |'
]
var footer = [
'',
'------------',
'_This is generated via `npm run stats`. Do not modify it directly._',
''
]
var lines = new Array(toposToWrite.length)
toposToWrite.forEach(function (topo, i) {
var r = topo.r
var s = topo.s
var inPath = common.topojsonDir + common.out(r, s.name)
fs.readFile(inPath, 'utf-8', function (err, code) {
if (err) throw err
lines[i] = '| ' + [
common.out(r, s.name),
prettySize(code.length),
prettySize(gzipSize.sync(code))
].join(' | ') + ' |'
readBar.tick()
if (readBar.complete) {
var content = [].concat(header).concat(lines).concat(footer)
fs.writeFile(common.pathToStats, content.join('\n'), function (err) {
if (err) throw err
})
}
})
})
}