UNPKG

uint8arrays

Version:

Utility functions to make dealing with Uint8Arrays easier

8 lines 253 B
import bases from './util/bases.js'; export function toString(array, encoding = 'utf8') { const base = bases[encoding]; if (!base) { throw new Error(`Unsupported encoding "${ encoding }"`); } return base.encoder.encode(array).substring(1); }