base64-utf8-array
v1.0.3
Published
base64 en-decode using utf8 Uint8Array
Downloads
17
Readme
base64-utf8-array
Base64 en- and decoding for Uint8Arrays.
Runs on node and browsers.
Table of contents
Api
base64Decode
decodes a base64 encoded string to an Uint8Array of UTF8 chars/values
Parameters
sBase64
string
Examples
const { base64Decode, utf8ArrayToString } = require('base64-utf8-array')
const aUtf8 = base64Decode('YWJj')
const str = utf8ArrayToString(aUtf8)
//> str = 'abc'
Returns Uint8Array
base64Encode
encodes a Uint8Array of UTF8 chars/values to a base64 encoded string
Parameters
arrUint8
Uint8Array
Examples
const { stringToUtf8Array, base64Encode } = require('base64-utf8-array')
const aUtf8 = stringToUtf8Array('abc')
const sbase64 = base64Encode(aUtf8)
//> sbase64 = 'YWJj'
Returns string
utf8ArrayToString
converts a Uint8Array of UTF8 chars/values to a UTF16 string
Parameters
aUtf8
Uint8Array
Returns string UTF16 string
stringToUtf8Array
converts a UTF16 string to a Uint8Array of UTF8 chars/values
Parameters
str
string UTF16 string
Returns Uint8Array
Installation
Requires nodejs.
$ npm install --save base64-utf8-array
Tests
$ npm test
License
MIT licensed