as-data-uri-cli

0.1.0 • Public • Published

as-data-uri-cli

Command line tool to encode data into a data URI.

Similar to data-uri-to-file-cli, but

  • only uses stdio instead of read and writing files
  • supports url-encoded data URIs (e.g. data:text/plain,hello%20world)
  • supports an optional charset

npm version build status ISC-licensed chat on gitter

Usage

Usage:
    as-data-uri [--url-encoded] [--mime mime-type] [--charset utf8]

Options:
    --url-encoded  -u  Url-encode instead of base64.
    --mime         -m  Specify a mime type. Default: text/plain.
    --charset      -c  Specify an optional charset (for text only).

Examples:
    echo -n 'hello world' | as-data-uri --mime text/plain --url-encoded
    cat picture.png | as-data-uri --mime image/png | pbcopy

If you have installed it:

echo -n 'Hello World!' | as-data-uri -m text/plain -u
# data:text/plain,hello%20world 
cat foo.png | as-data-uri -m image/png
# data:image/png;base64,iVBORw0K…CYII= 

Contributing

If you have a question or have difficulties using as-data-uri-cli, please double-check your code and setup first. If you think you have found a bug or want to propose a feature, refer to the issues page.

Package Sidebar

Install

npm i as-data-uri-cli

Weekly Downloads

1

Version

0.1.0

License

ISC

Unpacked Size

5.08 kB

Total Files

5

Last publish

Collaborators

  • derhuerst