import * as t from 'io-ts' ; export const stringFromBufferRt = new t . Type < string , Buffer , unknown > ( 'stringFromBufferRt' , t . string . is , ( input , context ) => { return Buffer . isBuffer ( input ) ? t . success ( input . toString ( 'utf-8' ) ) : t . failure ( input , context , 'Input is not a Buffer' ) ; } , ( str ) => { return Buffer . from ( str ) ; } ) ;