node package manager
Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org »


base64-format Build Status

Re-format base64 data from one implementation to another.


For the latest list, please refer to base64-variants.

  • base64: Vanilla base64 - default
  • base64_64/: Vanilla base64, with 64-char lines
  • base64_76: Vanilla base64, with 76-char lines
  • rfc4648: RFC 4648 (base64url)
  • rfc4648_alt: RFC 4648 with "="
  • rfc4648_ni: RFC 6920 (unpadded RFC 4648)
  • y64: YUI "Y64"
  • xml: XML-compatible


npm install base64-format


var base64Format = require("base64-format");
var options = {
    from: "base64",
    to: "rfc4648"
base64Format(options, "heLLO+/="); //=> "heLLO-_."" 

Note: this module supports currying.

var rfc4648 = base64Format({ from: "base64", to: "RFC 4648" });
rfc4648("heLLO+/="); //=> "heLLO-_." 


Key: type name = default

  • string from = "base64"
    Desired "from" base64 variant (see "Variants").

  • string to = "base64"
    Desired "to" base64 variant (see "Variants").

  • boolean clean = true
    Remove non-encoding characters (courtesy of base64-clean)?