string/to-base64
v0.0.1
0.0.1
Collaborators
Gravatar for undefined
0
MIT
PUBLIC
0
0     DEPENDENCIES
BuildPass

encode a string or a buffer to base64

Use string/to-base64 in your project
npm i @bit/bit.utils.string.to-base64

toBase64 (val:(string|Buffer)) : string

encode a string or a buffer to base64

Example

toBase64('foo bar') // => Zm9vIGJhcg==
 toBase64(new Buffer('foo bar')) // => Zm9vIGJhcg==

Argument

val: (string|Buffer)

string or buffer to encode

Returns

string

base64 encoded string

Test Summary


#toBase64() should return a base64 encoded string for string `foo bar`Pass
#toBase64() should return a base64 encoded string for buffer `foo bar`Pass
#toBase64() should not mutate given referencePass