method
b64encode
v1_8_7_72 -
Show latest stable
- Class:
Base64
b64encode(bin, len = 60)public
Prints the Base64 encoded version of bin (a String) in lines of len (default 60) characters.
require 'base64' data = "Now is the time for all good coders\nto learn Ruby" Base64.b64encode(data)
Generates:
Tm93IGlzIHRoZSB0aW1lIGZvciBhbGwgZ29vZCBjb2RlcnMKdG8gbGVhcm4g UnVieQ==
1Note
Use encode64!
b64encode will print to the commandline, what a useful feature...