const gzip = require ( "gzip-js" ) ; function getBinarySize ( str ) { return Buffer . byteLength ( str , "utf8" ) ; } export interface SizeResults { in : number ; out : number ; inZip : number ; outZip : number ; } export function process ( pre , opts , post ) { return post ( ) . then ( ( post ) => { let zipPre = gzip . zip ( pre , { level : opts . level || 6 , name : "pre.css" , timestamp : Date . now ( ) / 1000 , } ) ; let zipPost = gzip . zip ( post . css , { level : opts . level || 6 , name : "post.css" , timestamp : Date . now ( ) / 1000 , } ) ; return Promise . resolve ( { in : getBinarySize ( pre ) , out : getBinarySize ( post . css ) , inZip : zipPre . length , outZip : zipPost . length , } ) ; } ) ; }