import { readBytes , writeBytes } from './bytes' ; export const writeString = ( value ) : Buffer => { const stringBuffer = Buffer . from ( value , 'utf8' ) ; return writeBytes ( stringBuffer ) ; } ; export const readString = ( buffer , offset ) : [ string , number ] => { const [ value , size ] = readBytes ( buffer , offset ) ; return [ value . toString ( 'utf8' ) , size ] ; } ;