Namespace: base64

util. base64

A minimal base64 implementation for number arrays.

Methods

util.base64.decode(string, buffer, offset){ number }

Decodes a base64 encoded string to a buffer.

Name Type Description
string string

Source string

buffer Uint8Array

Destination buffer

offset number

Destination offset

Throws:
Type Description
Error

If encoding is invalid

Returns:
Type Description
number Number of bytes written

util.base64.encode(buffer, start, end){ string }

Encodes a buffer to a base64 encoded string.

Name Type Description
buffer Uint8Array

Source buffer

start number

Source start

end number

Source end

Returns:
Type Description
string Base64 encoded string

util.base64.length(string){ number }

Calculates the byte length of a base64 encoded string.

Name Type Description
string string

Base64 encoded string

Returns:
Type Description
number Byte length

util.base64.test(string){ boolean }

Tests if the specified string appears to be base64 encoded.

Name Type Description
string string

String to test

Returns:
Type Description
boolean true if probably base64 encoded, otherwise false