to-base64

v1.0.0arrow_drop_down
v1.0.0
v0.0.1
STATUS
Passing
DOWNLOADS
26
LICENSE
MIT
VISIBILITY
Public
PUBLISHED
7 years ago
SIZE
7 KB
encode a string or a buffer to base64
2 contributors
Install to-base64 as a package?
Copied
npm i @bit/bit.utils.string.to-base64
Set Bit as a scoped registryLearn more
npm config set '@bit:registry' https://node.bit.cloud
Component Example
React
React
Vue
Angular
React Native
Add dependency... help_outline
Just
import
any of the 1 million components
and packages in Bit or NPM to the example.
import Button from '@bit/grommet.grommet.button';
import Lodash from 'lodash';
toggle layout
No preview available
modifieddraft
chevron_left
chevron_right
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 reference

Pass
Help and resources