Skip to content

abiriadev/dataurl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

dataurl

convert given file to data URL

Installation

$ go install github.com/abiriadev/dataurl@latest

Usage

Encode

$ dataurl ./image.png
data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABAQMAAAAl21bKAAAAA1BMVEUAAACnej3aAAAAAXRSTlMAQObYZgAAAApJREFUCNdjYAAAAAIAAeIhvDMAAAAASUVORK5C

Specify MIME types

$ dataurl ./post.md
data:text/markdown; charset=utf-8;base64,IyBIZWxsbywgd29ybGQh

$ dataurl --mime 'text/plain; charset=UTF-8' ./post.md
data:text/plain; charset=UTF-8;base64,IyBIZWxsbywgd29ybGQh

Read from standard input

$ dataurl < ./post.md
data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABAQMAAAAl21bKAAAAA1BMVEUAAACnej3aAAAAAXRSTlMAQObYZgAAAApJREFUCNdjYAAAAAIAAeIhvDMAAAAASUVORK5C

$ dataurl --mime 'text/plain; charset=UTF-8' ./post.md
data:text/plain; charset=UTF-8;base64,IyBIZWxsbywgd29ybGQh

License

Licence

About

convert given file to data URL

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages