export function lpad(e,t,r){for(;e.length<t;)e=r+e;return e}export function rpad(e,t,r){for(;e.length<t;)e+=r;return e}export function writeField(e,t,r,n){for(var o=toBuffer(r),i=0;i<t;i++)e.setUint8(n,o[i]),n++;return n}export function toBuffer(e){if("function"==typeof TextEncoder)return(new TextEncoder).encode(e);for(var t=new Uint16Array(e.length),r=0;r<e.length;r++)t[r]=e.charCodeAt(r);return t}export function writeDate(e){return!e||isNaN(e.getTime())?"        ":("0000"+e.getFullYear()).slice(-4)+("00"+(e.getMonth()+1)).slice(-2)+("00"+e.getDate()).slice(-2)}