Display filesizes of the mbtiles

This commit is contained in:
Petr Sloup
2016-05-04 13:07:09 +02:00
parent 10caaa1e8b
commit 5d940066d9
3 changed files with 18 additions and 4 deletions

View File

@@ -214,6 +214,19 @@ module.exports = function(opts, callback) {
Math.floor(centerPx[1] / 256) + '.' + data_.format;
}
}
if (data_.filesize) {
var suffix = 'kB';
var size = parseInt(data_.filesize, 10) / 1024;
if (size > 1024) {
suffix = 'MB';
size /= 1024;
}
if (size > 1024) {
suffix = 'GB';
size /= 1024;
}
data_.formatted_filesize = size.toFixed(2) + ' ' + suffix;
}
});
return {
styles: styles,