How to use hex-to-array-buffer - 1 common examples

To help you get started, we’ve selected a few hex-to-array-buffer examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github isomorphic-git / isomorphic-git / src / utils / TinyBuffer.js View on Github external
function fromString (src, encoding = 'utf8') {
  switch (encoding) {
    case 'utf8': {
      return fromUTF8(src)
    }
    case 'hex': {
      return new Uint8Array(fromHex(src))
    }
    case 'base64': {
      return fromBase64(src)
    }
    default: {
      throw new Error(`Unsupported encoding ${encoding}`)
    }
  }
}

hex-to-array-buffer

Turn a string of hexadecimal characters into an `ArrayBuffer`.

MIT
Latest version published 3 years ago

Package Health Score

45 / 100
Full package analysis

Popular hex-to-array-buffer functions