Strict::Data::Uri

This en- and decodes data URIs.

This was inspired by data-uri.

Installation

Add this line to your application's Gemfile:

gem 'strict-data-uri'

And then execute:

bundle install

Usage

Encode a string into a data URI:

Strict::Data::Uri.encode "string"
# => data:text/plain;base64,c3RyaW5n

Decode a data URI:

Strict::Data::Uri.decode "data:text/plain;base64,c3RyaW5n"
# => string

Testing

To run the tests:

bundle exec rake

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/strict-data-uri.

License

The gem is available as open source under the terms of the MIT License.