Binary Data Language-Independent Type for YAML™ Version 1.1

Working Draft 2005-01-18

Oren Ben-Kiki

Clark Evans

Brian Ingerson

This document may be freely copied provided it is not modified.

Status

This specification is a draft reflecting consensus reached by members of the yaml-core mailing list. Any questions regarding this draft should be raised on this list.


URI:

tag:yaml.org,2002:binary

Shorthand:

!!binary

Kind:

Scalar.

Canonical:

Base64 without white space and line breaks.

Regexp:

Base64 including white space and line breaks.

Definition:

A sequence of zero or more octets (8 bit values).

Binary data is serialized using the base64 format as defined by RFC2045 (MIME), with the following notes:

  • The content is not restricted to lines of 76 characters or less.

  • Characters other than the base64 alphabet, line breaks and white space are considered an error.

Base64 is the recommended way to store opaque binary data in YAML files. Note that many forms of binary data have internal structure that may benefit from being represented as YAML nodes (e.g. the Java serialization format).

Example 1. !!binary Examples

canonical: !!binary "\
 R0lGODlhDAAMAIQAAP//9/X17unp5WZmZgAAAOfn515eXvPz7Y6OjuDg4J+fn5\
 OTk6enp56enmlpaWNjY6Ojo4SEhP/++f/++f/++f/++f/++f/++f/++f/++f/+\
 +f/++f/++f/++f/++f/++SH+Dk1hZGUgd2l0aCBHSU1QACwAAAAADAAMAAAFLC\
 AgjoEwnuNAFOhpEMTRiggcz4BNJHrv/zCFcLiwMWYNG84BwwEeECcgggoBADs="
generic: !binary |
 R0lGODlhDAAMAIQAAP//9/X17unp5WZmZgAAAOfn515eXvPz7Y6OjuDg4J+fn5
 OTk6enp56enmlpaWNjY6Ojo4SEhP/++f/++f/++f/++f/++f/++f/++f/++f/+
 +f/++f/++f/++f/++f/++SH+Dk1hZGUgd2l0aCBHSU1QACwAAAAADAAMAAAFLC
 AgjoEwnuNAFOhpEMTRiggcz4BNJHrv/zCFcLiwMWYNG84BwwEeECcgggoBADs=
description:
 The binary value above is a tiny arrow encoded as a gif image.