Skip to content
Go back

Base64Encoding

Table of contents

Open Table of contents

Why Bother with Base64?

Ever have a text only channel? use Base64 to encode your binary or non-text data to text and pass it through. Examples of text channels include yaml,json,urls.

Tokens / opaque blobs

Provides a package format to passing around. Such as OAuth tokens.

URL-safe identifiers

For maps, cache, and filenames, to avoid errors with file system path separators, encoding to base64 saves a lot of heaache.

Single-File Transport

For use cases such as inline assets, you can consider the data to base64 and transmite that to be decoded on the client browser. Binary data in text-only channels

Given URLs, JSON, YAMLs can’t carry raw bytes. Base64 encode them.

<img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAA..." />

Or to embed the data into text only objects such as json/yaml.

{
  "cert": "LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0t"
}

Share this post on:

Previous Post
Terraform Quick Notes
Next Post
Public and Private Key