import stream from 'stream' ; import { CompressOptions } from '../interfaces' ; export abstract class Compression < T > { compressionOptions : T = { } as T ; abstract ext : string ; abstract compressionName : string ; protected readonly options : CompressOptions ; /**
     * Creates an instance of Compression.
     */ constructor ( options ) { this . options = options ; this . selectCompression ( ) ; } /**
     * Returns a compression instance in closure.
     */ abstract getCompression ( ) ; /**
     * Build compression options object [compressionOptions].
     */ protected abstract selectCompression ( ) ; /**
     * Returns human-readable compression options info.
     */ readableOptions ( keyWrapper = ( key ) : string | undefined => key ) { let options = '' ; for ( const [ key , value ] of Object . entries ( this . compressionOptions ) ) { options += `${ keyWrapper ( key ) }: ${ value }, ` ; } return `${ this . compressionName } | ${ options . slice ( 0 , - 2 ) }` ; } }