/**
 * encapsulates encoding and decoding of arbitrary binary data into text
 */ export interface Encoder { encode ( data ) : string ; decode ( data ) : Buffer ; } returns export const createPlaintextEncoder = ( ) : Encoder => ( { encode : ( data ) : string => data . toString ( "utf8" ) , decode : ( data ) : Buffer => Buffer . from ( data , "utf8" ) , } ) ; returns export const createBase64Encoder = ( ) : Encoder => ( { encode : ( data ) : string => data . toString ( "base64" ) , decode : ( data ) : Buffer => Buffer . from ( data , "base64" ) , } ) ;