Skip to content

tomquas/as-data-uri-cli

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

Command line tool to encode data into a data URI.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%