UNPKG

uint8-encoding

Version:

Uint8 encoding, a simple way to convert strings to Uint8Arrays and vice versa.

16 lines (15 loc) 320 B
/* HELPERS */ const encoder = new TextEncoder(); const decoder = new TextDecoder('utf-8', { ignoreBOM: true }); /* MAIN */ const U8 = { /* API */ encode: (data) => { return encoder.encode(data); }, decode: (data) => { return decoder.decode(data); } }; /* EXPORT */ export default U8;