Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Home

nzakas edited this page · 5 revisions
Clone this wiki locally

Introduction

DataURI is a simple utility to automate creation of data URIs. It is capable of creating base64-encoded data URIs for the following types of files:

  • PNG images
  • GIF images
  • JPEG images
  • HTML files
  • XHTML files
  • XML files
  • Plain text files
  • JavaScript files
  • CSS files

Basic Usage

DataURI is used as follows:

java -jar datauri-x.y.z.jar <options> <file>

For example:

java -jar datauri-x.y.z.jar -v folder.png

The -v or --verbose flags result in additional messages and warnings being output to the console, which can be useful if you run into problems.

Using the -h option shows all of the options:

Usage: java -jar datauri-x.y.z.jar [options] [input file]

Global Options
   -h, --help            Displays this information.
   --charset <charset>   Character set of the input file.
   -v, --verbose         Display informational messages and warnings.
   -m, --mime <type>     Mime type to encode into the data URI.
   -o <file>             Place the output into <file>. Defaults to stdout.

Dependencies

When downloading and using DataURI, you can download one of two files:

datauri-x.y.z.jar contains all of the dependencies necessary to run DataURI. You can simply run this on the command line and everything will work.

datauri-core-x.y.z.jar contains just DataURI and so you’ll need to add the dependencies manually to the classpath. There is one dependency:

Copyright and License

Copyright © 2009 Nicholas C. Zakas. All rights reserved.

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Something went wrong with that request. Please try again.