0.1.2 • Published 9 years ago

base64-format v0.1.2

Weekly downloads
262
License
MIT
Repository
github
Last release
9 years ago

base64-format Build Status

Re-format base64 data from one implementation to another.

Variants

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

Install

npm install base64-format

Usage

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-_."

Options

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)?